json-schema 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/json-schema/validator.rb +6 -4
- metadata +3 -3
@@ -467,7 +467,7 @@ module JSON
|
|
467
467
|
# Grab the parent schema from the schema list
|
468
468
|
schema_key = temp_uri.to_s.split("#")[0]
|
469
469
|
ref_schema = Validator.schemas[schema_key]
|
470
|
-
|
470
|
+
|
471
471
|
if ref_schema
|
472
472
|
# Perform fragment resolution to retrieve the appropriate level for the schema
|
473
473
|
target_schema = ref_schema.schema
|
@@ -485,6 +485,8 @@ module JSON
|
|
485
485
|
# We have the schema finally, build it and validate!
|
486
486
|
schema = JSON::Schema.new(target_schema,temp_uri)
|
487
487
|
validate_schema(schema, data, fragments)
|
488
|
+
else
|
489
|
+
raise ValidationError.new("The referenced schema '#{temp_uri.to_s}' cannot be found", fragments, current_schema)
|
488
490
|
end
|
489
491
|
end
|
490
492
|
|
@@ -525,8 +527,7 @@ module JSON
|
|
525
527
|
|
526
528
|
|
527
529
|
# Build all schemas with IDs, mapping out the namespace
|
528
|
-
def build_schemas(parent_schema)
|
529
|
-
|
530
|
+
def build_schemas(parent_schema)
|
530
531
|
# Check for schemas in union types
|
531
532
|
["type", "disallow"].each do |key|
|
532
533
|
if parent_schema.schema[key] && parent_schema.schema[key].is_a?(Array)
|
@@ -650,8 +651,9 @@ module JSON
|
|
650
651
|
end
|
651
652
|
|
652
653
|
if @options[:list]
|
653
|
-
inter_json = {:type => "array", :items => schema.
|
654
|
+
inter_json = {:type => "array", :items => { "$ref" => schema.uri.to_s }}.to_json
|
654
655
|
wrapper_schema = JSON::Schema.new(JSON.parse(inter_json),URI.parse("file://#{Dir.pwd}/#{Digest::SHA1.hexdigest(inter_json)}"))
|
656
|
+
build_schemas(schema)
|
655
657
|
schema = wrapper_schema
|
656
658
|
end
|
657
659
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 9
|
10
|
+
version: 0.1.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kenny Hoxworth
|