json-schema 2.5.2 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0448122a379f2472a1f14ca8cc02dfe622f64c4d
4
- data.tar.gz: b9ef1a82305726ab44107d6fd078aad9517d33de
3
+ metadata.gz: a58ce34e91bb60549bef3c7018d69636c87052a8
4
+ data.tar.gz: 22573ae4c67684bc8e180876fe7485cf24baed19
5
5
  SHA512:
6
- metadata.gz: 86eeeb455c88470dd99dfe377e30f12f750dc55b62085131995b5079fbd2cd91515b9eb27a06fe15ffb6084f39cba5c6026cef8c78491a8d344279c621cf3886
7
- data.tar.gz: 8d3cce427d1c3d1526bfa8b46ccb62a54683ac7cc19e0eb64a7b5a2bc3da8130343db1807fd227c814a64e7141f6fb983cb705fa4660faf46c5201250d662303
6
+ metadata.gz: 074129e7c341baadf05037ef05b9bc3a7c72f0414e420d92b74f4e25acbb6a42da478bfb7d658e4150887156455cb71575e3a02d877be50a0a482210ef08c6e5
7
+ data.tar.gz: c05121d91c8cd2f2a0d3a21e91fccb4a902b24b30bf8f594c6ef3f3c434b586422565cb526894632c10f91ea0248c9ca062d8b1afb8048ae64843bfaac7b9b01
@@ -214,7 +214,7 @@ schema = {
214
214
  "type" => "object",
215
215
  "required" => ["a"],
216
216
  "properties" => {
217
- "a" => {"type" => "integer"} # This will fail schema validation!
217
+ "a" => {"type" => "integer", "required" => "true"} # This will fail schema validation!
218
218
  }
219
219
  }
220
220
 
@@ -11,7 +11,8 @@ module JSON
11
11
  if REGEXP.match(data)
12
12
  begin
13
13
  Date.parse(data)
14
- rescue Exception
14
+ rescue ArgumentError => e
15
+ raise e unless e.message == 'invalid date'
15
16
  validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors])
16
17
  end
17
18
  else
@@ -14,18 +14,16 @@ module JSON
14
14
 
15
15
  begin
16
16
  Date.parse(parts[0])
17
- rescue Exception
17
+ rescue ArgumentError => e
18
+ raise e unless e.message == 'invalid date'
18
19
  validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors])
19
20
  return
20
21
  end
21
22
 
22
- begin
23
- validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors]) and return if m[1].to_i > 23
24
- validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors]) and return if m[2].to_i > 59
25
- validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors]) and return if m[3].to_i > 59
26
- rescue Exception
27
- validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors])
28
- end
23
+ validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors]) and return if m.length < 4
24
+ validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors]) and return if m[1].to_i > 23
25
+ validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors]) and return if m[2].to_i > 59
26
+ validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors]) and return if m[3].to_i > 59
29
27
  else
30
28
  validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors])
31
29
  end
@@ -1,5 +1,6 @@
1
1
  require 'json-schema/attribute'
2
- require 'addressable/uri'
2
+ require 'json-schema/errors/uri_error'
3
+
3
4
  module JSON
4
5
  class Schema
5
6
  class UriFormat < FormatAttribute
@@ -7,8 +8,8 @@ module JSON
7
8
  return unless data.is_a?(String)
8
9
  error_message = "The property '#{build_fragment(fragments)}' must be a valid URI"
9
10
  begin
10
- Addressable::URI.parse(data)
11
- rescue Addressable::URI::InvalidURIError
11
+ JSON::Util::URI.parse(data)
12
+ rescue JSON::Schema::UriError
12
13
  validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors])
13
14
  end
14
15
  end
@@ -17,7 +17,7 @@ module JSON
17
17
  message = "The property '#{build_fragment(fragments)}' of type #{data.class} matched the disallowed schema"
18
18
  failed = false
19
19
  end
20
- rescue
20
+ rescue ValidationError
21
21
  # Yay, we failed validation.
22
22
  end
23
23
 
@@ -1,5 +1,6 @@
1
1
  require 'json-schema/attribute'
2
2
  require 'json-schema/errors/schema_error'
3
+ require 'json-schema/util/uri'
3
4
 
4
5
  module JSON
5
6
  class Schema
@@ -21,21 +22,23 @@ module JSON
21
22
  def self.get_referenced_uri_and_schema(s, current_schema, validator)
22
23
  uri,schema = nil,nil
23
24
 
24
- temp_uri = Addressable::URI.parse(s['$ref'])
25
- if temp_uri.relative?
26
- temp_uri = current_schema.uri.clone
27
- # Check for absolute path
28
- path = s['$ref'].split("#")[0]
29
- if path.nil? || path == ''
30
- temp_uri.path = current_schema.uri.path
31
- elsif path[0,1] == "/"
32
- temp_uri.path = Pathname.new(path).cleanpath.to_s
33
- else
34
- temp_uri = current_schema.uri.join(path)
25
+ temp_uri = JSON::Util::URI.parse(s['$ref'])
26
+ temp_uri.defer_validation do
27
+ if temp_uri.relative?
28
+ temp_uri.merge!(current_schema.uri)
29
+ # Check for absolute path
30
+ path, fragment = s['$ref'].split("#")
31
+ if path.nil? || path == ''
32
+ temp_uri.path = current_schema.uri.path
33
+ elsif path[0,1] == "/"
34
+ temp_uri.path = Pathname.new(path).cleanpath.to_s
35
+ else
36
+ temp_uri.join!(path)
37
+ end
38
+ temp_uri.fragment = fragment
35
39
  end
36
- temp_uri.fragment = s['$ref'].split("#")[1]
40
+ temp_uri.fragment = "" if temp_uri.fragment.nil? || temp_uri.fragment.empty?
37
41
  end
38
- temp_uri.fragment = "" if temp_uri.fragment.nil?
39
42
 
40
43
  # Grab the parent schema from the schema list
41
44
  schema_key = temp_uri.to_s.split("#")[0] + "#"
@@ -49,7 +52,7 @@ module JSON
49
52
  fragment_path = ''
50
53
  fragments.each do |fragment|
51
54
  if fragment && fragment != ''
52
- fragment = Addressable::URI.unescape(fragment.gsub('~0', '~').gsub('~1', '/'))
55
+ fragment = JSON::Util::URI.unescaped_uri(fragment.gsub('~0', '~').gsub('~1', '/'))
53
56
  if target_schema.is_a?(Array)
54
57
  target_schema = target_schema[fragment.to_i]
55
58
  else
@@ -0,0 +1,6 @@
1
+ module JSON
2
+ class Schema
3
+ class JsonLoadError < StandardError
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ require 'json/common'
2
+
3
+ module JSON
4
+ class Schema
5
+ class SchemaParseError < JSON::ParserError
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ module JSON
2
+ class Schema
3
+ class UriError < StandardError
4
+ end
5
+ end
6
+ end
@@ -11,13 +11,13 @@ module JSON
11
11
 
12
12
  # If there is an ID on this schema, use it to generate the URI
13
13
  if @schema['id'] && @schema['id'].kind_of?(String)
14
- temp_uri = Addressable::URI.parse(@schema['id'])
14
+ temp_uri = JSON::Util::URI.parse(@schema['id'])
15
15
  if temp_uri.relative?
16
16
  temp_uri = uri.join(temp_uri)
17
17
  end
18
18
  @uri = temp_uri
19
19
  end
20
- @uri.fragment = ''
20
+ @uri = JSON::Util::URI.strip_fragment(@uri)
21
21
 
22
22
  # If there is a $schema on this schema, use it to determine which validator to use
23
23
  if @schema['$schema']
@@ -60,4 +60,3 @@ module JSON
60
60
  end
61
61
  end
62
62
  end
63
-
@@ -1,5 +1,4 @@
1
1
  require 'open-uri'
2
- require 'addressable/uri'
3
2
  require 'pathname'
4
3
 
5
4
  module JSON
@@ -57,12 +56,12 @@ module JSON
57
56
  # @param location [#to_s] The location from which to read the schema
58
57
  # @return [JSON::Schema]
59
58
  # @raise [JSON::Schema::ReadRefused] if +accept_uri+ or +accept_file+
60
- # indicated the schema should not be readed
61
- # @raise [JSON::ParserError] if the schema was not a valid JSON object
59
+ # indicated the schema could not be read
60
+ # @raise [JSON::Schema::ParseError] if the schema was not a valid JSON object
62
61
  def read(location)
63
- uri = Addressable::URI.parse(location.to_s)
62
+ uri = JSON::Util::URI.parse(location.to_s)
64
63
  body = if uri.scheme.nil? || uri.scheme == 'file'
65
- uri = Addressable::URI.convert_path(uri.path)
64
+ uri = JSON::Util::URI.file_uri(uri)
66
65
  read_file(Pathname.new(uri.path).expand_path)
67
66
  else
68
67
  read_uri(uri)
@@ -103,7 +102,7 @@ module JSON
103
102
 
104
103
  def read_file(pathname)
105
104
  if accept_file?(pathname)
106
- File.read(Addressable::URI.unescape(pathname.to_s))
105
+ File.read(JSON::Util::URI.unescaped_uri(pathname.to_s))
107
106
  else
108
107
  raise JSON::Schema::ReadRefused.new(pathname.to_s, :file)
109
108
  end
@@ -1,15 +1,63 @@
1
+ require 'addressable/uri'
2
+
1
3
  module JSON
2
4
  module Util
3
5
  module URI
4
- def self.normalized_uri(uri)
5
- uri = Addressable::URI.parse(uri) unless uri.is_a?(Addressable::URI)
6
- # Check for absolute path
7
- if uri.relative?
8
- data = uri.to_s
9
- data = "#{Dir.pwd}/#{data}" if data[0,1] != '/'
10
- uri = Addressable::URI.convert_path(data)
6
+ SUPPORTED_PROTOCOLS = %w(http https ftp tftp sftp ssh svn+ssh telnet nntp gopher wais ldap prospero)
7
+
8
+ def self.normalized_uri(uri, base_path = Dir.pwd)
9
+ @normalize_cache ||= {}
10
+ normalized_uri = @normalize_cache[uri]
11
+
12
+ if !normalized_uri
13
+ normalized_uri = parse(uri)
14
+ # Check for absolute path
15
+ if normalized_uri.relative?
16
+ data = normalized_uri
17
+ data = File.join(base_path, data) if data.path[0,1] != "/"
18
+ normalized_uri = file_uri(data)
19
+ end
20
+ @normalize_cache[uri] = normalized_uri.freeze
11
21
  end
12
- uri
22
+
23
+ normalized_uri
24
+ end
25
+
26
+ def self.parse(uri)
27
+ if uri.is_a?(Addressable::URI)
28
+ return uri.dup
29
+ else
30
+ @parse_cache ||= {}
31
+ parsed_uri = @parse_cache[uri]
32
+ if parsed_uri
33
+ parsed_uri.dup
34
+ else
35
+ @parse_cache[uri] = Addressable::URI.parse(uri)
36
+ end
37
+ end
38
+ rescue Addressable::URI::InvalidURIError => e
39
+ raise JSON::Schema::UriError.new(e.message)
40
+ end
41
+
42
+ def self.strip_fragment(uri)
43
+ parsed_uri = parse(uri)
44
+ if parsed_uri.fragment.nil? || parsed_uri.fragment.empty?
45
+ parsed_uri
46
+ else
47
+ parsed_uri.merge(:fragment => "")
48
+ end
49
+ end
50
+
51
+ def self.file_uri(uri)
52
+ parsed_uri = parse(uri)
53
+
54
+ Addressable::URI.convert_path(parsed_uri.path)
55
+ end
56
+
57
+ def self.unescaped_uri(uri)
58
+ parsed_uri = parse(uri)
59
+
60
+ Addressable::URI.unescape(parsed_uri.path)
13
61
  end
14
62
  end
15
63
  end
@@ -1,4 +1,3 @@
1
- require 'addressable/uri'
2
1
  require 'open-uri'
3
2
  require 'pathname'
4
3
  require 'bigdecimal'
@@ -9,7 +8,10 @@ require 'yaml'
9
8
 
10
9
  require 'json-schema/schema/reader'
11
10
  require 'json-schema/errors/schema_error'
11
+ require 'json-schema/errors/schema_parse_error'
12
+ require 'json-schema/errors/json_load_error'
12
13
  require 'json-schema/errors/json_parse_error'
14
+ require 'json-schema/util/uri'
13
15
 
14
16
  module JSON
15
17
 
@@ -55,17 +57,13 @@ module JSON
55
57
 
56
58
  # validate the schema, if requested
57
59
  if @options[:validate_schema]
58
- begin
59
- if @base_schema.schema["$schema"]
60
- base_validator = JSON::Validator.validator_for_name(@base_schema.schema["$schema"])
61
- end
62
- metaschema = base_validator ? base_validator.metaschema : validator.metaschema
63
- # Don't clear the cache during metaschema validation!
64
- meta_validator = JSON::Validator.new(metaschema, @base_schema.schema, {:clear_cache => false})
65
- meta_validator.validate
66
- rescue JSON::Schema::ValidationError, JSON::Schema::SchemaError
67
- raise $!
60
+ if @base_schema.schema["$schema"]
61
+ base_validator = JSON::Validator.validator_for_name(@base_schema.schema["$schema"])
68
62
  end
63
+ metaschema = base_validator ? base_validator.metaschema : validator.metaschema
64
+ # Don't clear the cache during metaschema validation!
65
+ meta_validator = JSON::Validator.new(metaschema, @base_schema.schema, {:clear_cache => false})
66
+ meta_validator.validate
69
67
  end
70
68
 
71
69
  # If the :fragment option is set, try and validate against the fragment
@@ -138,15 +136,13 @@ module JSON
138
136
  end
139
137
 
140
138
  def absolutize_ref_uri(ref, parent_schema_uri)
141
- ref_uri = Addressable::URI.parse(ref)
142
- ref_uri.fragment = ''
139
+ ref_uri = JSON::Util::URI.strip_fragment(ref)
143
140
 
144
141
  return ref_uri if ref_uri.absolute?
145
142
  # This is a self reference and thus the schema does not need to be re-loaded
146
143
  return parent_schema_uri if ref_uri.path.empty?
147
144
 
148
- uri = parent_schema_uri.clone
149
- uri.fragment = ''
145
+ uri = JSON::Util::URI.strip_fragment(parent_schema_uri.dup)
150
146
  Util::URI.normalized_uri(uri.join(ref_uri.path))
151
147
  end
152
148
 
@@ -222,7 +218,7 @@ module JSON
222
218
  # Either load a reference schema or create a new schema
223
219
  def handle_schema(parent_schema, obj)
224
220
  if obj.is_a?(Hash)
225
- schema_uri = parent_schema.uri.clone
221
+ schema_uri = parent_schema.uri.dup
226
222
  schema = JSON::Schema.new(obj, schema_uri, parent_schema.validator)
227
223
  if obj['id']
228
224
  Validator.add_schema(schema)
@@ -344,7 +340,7 @@ module JSON
344
340
 
345
341
  def validator_for_uri(schema_uri)
346
342
  return default_validator unless schema_uri
347
- u = Addressable::URI.parse(schema_uri)
343
+ u = JSON::Util::URI.parse(schema_uri)
348
344
  validator = validators["#{u.scheme}://#{u.host}#{u.path}"]
349
345
  if validator.nil?
350
346
  raise JSON::Schema::SchemaError.new("Schema not found: #{schema_uri}")
@@ -416,15 +412,27 @@ module JSON
416
412
 
417
413
  def parse(s)
418
414
  if defined?(MultiJson)
419
- MultiJson.respond_to?(:adapter) ? MultiJson.load(s) : MultiJson.decode(s)
415
+ begin
416
+ MultiJson.respond_to?(:adapter) ? MultiJson.load(s) : MultiJson.decode(s)
417
+ rescue MultiJson::ParseError => e
418
+ raise JSON::Schema::JsonParseError.new(e.message)
419
+ end
420
420
  else
421
421
  case @@json_backend.to_s
422
422
  when 'json'
423
- JSON.parse(s, :quirks_mode => true)
423
+ begin
424
+ JSON.parse(s, :quirks_mode => true)
425
+ rescue JSON::ParserError => e
426
+ raise JSON::Schema::JsonParseError.new(e.message)
427
+ end
424
428
  when 'yajl'
425
- json = StringIO.new(s)
426
- parser = Yajl::Parser.new
427
- parser.parse(json) or raise JSON::Schema::JsonParseError.new("The JSON could not be parsed by yajl")
429
+ begin
430
+ json = StringIO.new(s)
431
+ parser = Yajl::Parser.new
432
+ parser.parse(json) or raise JSON::Schema::JsonParseError.new("The JSON could not be parsed by yajl")
433
+ rescue Yajl::ParseError => e
434
+ raise JSON::Schema::JsonParseError.new(e.message)
435
+ end
428
436
  else
429
437
  raise JSON::Schema::JsonParseError.new("No supported JSON parsers found. The following parsers are suported:\n * yajl-ruby\n * json")
430
438
  end
@@ -474,6 +482,8 @@ module JSON
474
482
 
475
483
  if @@json_backend == 'yajl'
476
484
  @@serializer = lambda{|o| Yajl::Encoder.encode(o) }
485
+ elsif @@json_backend == 'json'
486
+ @@serializer = lambda{|o| JSON.dump(o) }
477
487
  else
478
488
  @@serializer = lambda{|o| YAML.dump(o) }
479
489
  end
@@ -522,13 +532,13 @@ module JSON
522
532
  if schema.is_a?(String)
523
533
  begin
524
534
  # Build a fake URI for this
525
- schema_uri = Addressable::URI.parse(fake_uuid(schema))
535
+ schema_uri = JSON::Util::URI.parse(fake_uuid(schema))
526
536
  schema = JSON::Schema.new(JSON::Validator.parse(schema), schema_uri, @options[:version])
527
537
  if @options[:list] && @options[:fragment].nil?
528
538
  schema = schema.to_array_schema
529
539
  end
530
540
  Validator.add_schema(schema)
531
- rescue
541
+ rescue JSON::Schema::JsonParseError
532
542
  # Build a uri for it
533
543
  schema_uri = Util::URI.normalized_uri(schema)
534
544
  if !self.class.schema_loaded?(schema_uri)
@@ -544,14 +554,14 @@ module JSON
544
554
  schema = self.class.schema_for_uri(schema_uri)
545
555
  if @options[:list] && @options[:fragment].nil?
546
556
  schema = schema.to_array_schema
547
- schema.uri = Addressable::URI.parse(fake_uuid(serialize(schema.schema)))
557
+ schema.uri = JSON::Util::URI.parse(fake_uuid(serialize(schema.schema)))
548
558
  Validator.add_schema(schema)
549
559
  end
550
560
  schema
551
561
  end
552
562
  end
553
563
  elsif schema.is_a?(Hash)
554
- schema_uri = Addressable::URI.parse(fake_uuid(serialize(schema)))
564
+ schema_uri = JSON::Util::URI.parse(fake_uuid(serialize(schema)))
555
565
  schema = JSON::Schema.stringify(schema)
556
566
  schema = JSON::Schema.new(schema, schema_uri, @options[:version])
557
567
  if @options[:list] && @options[:fragment].nil?
@@ -559,7 +569,7 @@ module JSON
559
569
  end
560
570
  Validator.add_schema(schema)
561
571
  else
562
- raise "Invalid schema - must be either a string or a hash"
572
+ raise SchemaParseError, "Invalid schema - must be either a string or a hash"
563
573
  end
564
574
 
565
575
  schema
@@ -575,12 +585,12 @@ module JSON
575
585
  elsif data.is_a?(String)
576
586
  begin
577
587
  data = JSON::Validator.parse(data)
578
- rescue
588
+ rescue JSON::Schema::JsonParseError
579
589
  begin
580
590
  json_uri = Util::URI.normalized_uri(data)
581
591
  data = JSON::Validator.parse(custom_open(json_uri))
582
- rescue
583
- # Silently discard the error - the data will not change
592
+ rescue JSON::Schema::JsonLoadError
593
+ # Silently discard the error - use the data as-is
584
594
  end
585
595
  end
586
596
  end
@@ -590,10 +600,18 @@ module JSON
590
600
 
591
601
  def custom_open(uri)
592
602
  uri = Util::URI.normalized_uri(uri) if uri.is_a?(String)
593
- if uri.absolute? && uri.scheme != 'file'
594
- open(uri.to_s).read
603
+ if uri.absolute? && Util::URI::SUPPORTED_PROTOCOLS.include?(uri.scheme)
604
+ begin
605
+ open(uri.to_s).read
606
+ rescue OpenURI::HTTPError, Timeout::Error => e
607
+ raise JSON::Schema::JsonLoadError, e.message
608
+ end
595
609
  else
596
- File.read(Addressable::URI.unescape(uri.path))
610
+ begin
611
+ File.read(JSON::Util::URI.unescaped_uri(uri))
612
+ rescue SystemCallError => e
613
+ raise JSON::Schema::JsonLoadError, e.message
614
+ end
597
615
  end
598
616
  end
599
617
  end
@@ -2,7 +2,7 @@ require 'json-schema/schema/validator'
2
2
 
3
3
  module JSON
4
4
  class Schema
5
-
5
+
6
6
  class Draft1 < Validator
7
7
  def initialize
8
8
  super
@@ -33,13 +33,13 @@ module JSON
33
33
  'uri' => UriFormat
34
34
  }
35
35
  @formats = @default_formats.clone
36
- @uri = Addressable::URI.parse("http://json-schema.org/draft-01/schema#")
36
+ @uri = JSON::Util::URI.parse("http://json-schema.org/draft-01/schema#")
37
37
  @names = ["draft1"]
38
38
  @metaschema_name = "draft-01.json"
39
39
  end
40
-
40
+
41
41
  JSON::Validator.register_validator(self.new)
42
42
  end
43
-
43
+
44
44
  end
45
45
  end
@@ -2,7 +2,7 @@ require 'json-schema/schema/validator'
2
2
 
3
3
  module JSON
4
4
  class Schema
5
-
5
+
6
6
  class Draft2 < Validator
7
7
  def initialize
8
8
  super
@@ -34,13 +34,13 @@ module JSON
34
34
  'uri' => UriFormat
35
35
  }
36
36
  @formats = @default_formats.clone
37
- @uri = Addressable::URI.parse("http://json-schema.org/draft-02/schema#")
37
+ @uri = JSON::Util::URI.parse("http://json-schema.org/draft-02/schema#")
38
38
  @names = ["draft2"]
39
39
  @metaschema_name = "draft-02.json"
40
40
  end
41
-
41
+
42
42
  JSON::Validator.register_validator(self.new)
43
43
  end
44
-
44
+
45
45
  end
46
46
  end
@@ -2,7 +2,7 @@ require 'json-schema/schema/validator'
2
2
 
3
3
  module JSON
4
4
  class Schema
5
-
5
+
6
6
  class Draft3 < Validator
7
7
  def initialize
8
8
  super
@@ -38,13 +38,13 @@ module JSON
38
38
  'uri' => UriFormat
39
39
  }
40
40
  @formats = @default_formats.clone
41
- @uri = Addressable::URI.parse("http://json-schema.org/draft-03/schema#")
41
+ @uri = JSON::Util::URI.parse("http://json-schema.org/draft-03/schema#")
42
42
  @names = ["draft3", "http://json-schema.org/draft-03/schema#"]
43
43
  @metaschema_name = "draft-03.json"
44
44
  end
45
-
45
+
46
46
  JSON::Validator.register_validator(self.new)
47
47
  end
48
-
48
+
49
49
  end
50
50
  end
@@ -43,7 +43,7 @@ module JSON
43
43
  'uri' => UriFormat
44
44
  }
45
45
  @formats = @default_formats.clone
46
- @uri = Addressable::URI.parse("http://json-schema.org/draft-04/schema#")
46
+ @uri = JSON::Util::URI.parse("http://json-schema.org/draft-04/schema#")
47
47
  @names = ["draft4", "http://json-schema.org/draft-04/schema#"]
48
48
  @metaschema_name = "draft-04.json"
49
49
  end
@@ -4,7 +4,7 @@ module JSON
4
4
  class HyperDraft1 < Draft1
5
5
  def initialize
6
6
  super
7
- @uri = Addressable::URI.parse("http://json-schema.org/draft-01/hyper-schema#")
7
+ @uri = JSON::Util::URI.parse("http://json-schema.org/draft-01/hyper-schema#")
8
8
  end
9
9
 
10
10
  JSON::Validator.register_validator(self.new)
@@ -4,7 +4,7 @@ module JSON
4
4
  class HyperDraft2 < Draft2
5
5
  def initialize
6
6
  super
7
- @uri = Addressable::URI.parse("http://json-schema.org/draft-02/hyper-schema#")
7
+ @uri = JSON::Util::URI.parse("http://json-schema.org/draft-02/hyper-schema#")
8
8
  end
9
9
 
10
10
  JSON::Validator.register_validator(self.new)
@@ -4,7 +4,7 @@ module JSON
4
4
  class HyperDraft4 < Draft4
5
5
  def initialize
6
6
  super
7
- @uri = Addressable::URI.parse("http://json-schema.org/draft-04/hyper-schema#")
7
+ @uri = JSON::Util::URI.parse("http://json-schema.org/draft-04/hyper-schema#")
8
8
  end
9
9
 
10
10
  JSON::Validator.register_validator(self.new)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.2
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenny Hoxworth
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-24 00:00:00.000000000 Z
11
+ date: 2016-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -125,8 +125,11 @@ files:
125
125
  - lib/json-schema/attributes/type_v4.rb
126
126
  - lib/json-schema/attributes/uniqueitems.rb
127
127
  - lib/json-schema/errors/custom_format_error.rb
128
+ - lib/json-schema/errors/json_load_error.rb
128
129
  - lib/json-schema/errors/json_parse_error.rb
129
130
  - lib/json-schema/errors/schema_error.rb
131
+ - lib/json-schema/errors/schema_parse_error.rb
132
+ - lib/json-schema/errors/uri_error.rb
130
133
  - lib/json-schema/errors/validation_error.rb
131
134
  - lib/json-schema/schema.rb
132
135
  - lib/json-schema/schema/reader.rb
@@ -166,8 +169,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
169
  version: '1.8'
167
170
  requirements: []
168
171
  rubyforge_project:
169
- rubygems_version: 2.4.8
172
+ rubygems_version: 2.5.1
170
173
  signing_key:
171
174
  specification_version: 4
172
175
  summary: Ruby JSON Schema Validator
173
176
  test_files: []
177
+ has_rdoc: