json_schema 0.20.6 → 0.20.7
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.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/json_schema/reference_expander.rb +1 -0
- data/test/json_schema/reference_expander_test.rb +32 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c800e1fd6f5a28d53899ac7832439c0c6ec66d8c4948484f60e42c195a2bc247
|
4
|
+
data.tar.gz: 1da408588552c827c26ff7d9606e805fc04e9b0efa3000176d23439c20d791e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 491ad2864ae84497a4c44ddc7dcef6cceb0dde648f04f04b70712898afa056ad3596cb0355deb56adf979a80c4ee90a4aaa4fc0b7048af5b550badb8ceabb7e9
|
7
|
+
data.tar.gz: b6307a601843446eba043e83ee7b9b1b36abeb3d9d0b8a5a766f835111807fd332929efca1f57ba64d57edb4450b2fad6528798e9c82a6e2866c37f15441c874
|
data/README.md
CHANGED
@@ -67,7 +67,8 @@ ruby -Ilib -Itest test/json_schema/validator_test.rb -n /anyOf/
|
|
67
67
|
|
68
68
|
1. Update the version in `json_schema.gemspec` as appropriate for [semantic
|
69
69
|
versioning](http://semver.org) and add details to `CHANGELOG`.
|
70
|
-
2.
|
70
|
+
2. `git commit` those changes with a message like "Bump version to x.y.z".
|
71
|
+
3. Run the `release` task:
|
71
72
|
|
72
73
|
```
|
73
74
|
bundle exec rake release
|
@@ -93,6 +93,7 @@ module JsonSchema
|
|
93
93
|
if !ref
|
94
94
|
schema_children(ref_schema) do |subschema|
|
95
95
|
next unless subschema.reference
|
96
|
+
next if ref_schema.uri == parent_ref.uri.to_s
|
96
97
|
|
97
98
|
if !subschema.reference.uri && parent_ref
|
98
99
|
subschema.reference = JsonReference::Reference.new("#{parent_ref.uri}#{subschema.reference.pointer}")
|
@@ -454,6 +454,38 @@ describe JsonSchema::ReferenceExpander do
|
|
454
454
|
assert_equal 3, schema1.properties["foo"].properties["bar"].one_of[1].properties["baz"].max_length
|
455
455
|
end
|
456
456
|
|
457
|
+
it "does not infinitely recurse when external ref is local to its schema" do
|
458
|
+
sample1 = {
|
459
|
+
"id" => "http://json-schema.org/draft-04/schema#",
|
460
|
+
"$schema" => "http://json-schema.org/draft-04/schema#",
|
461
|
+
"properties" => {
|
462
|
+
"additionalItems" => {
|
463
|
+
"anyOf" => [ { "$ref" => "#" } ]
|
464
|
+
}
|
465
|
+
}
|
466
|
+
}
|
467
|
+
schema1 = JsonSchema::Parser.new.parse!(sample1)
|
468
|
+
sample2 = {
|
469
|
+
"$schema" => "http://json-schema.org/draft-04/hyper-schema#",
|
470
|
+
"id" => "http://json-schema.org/draft-04/hyper-schema#",
|
471
|
+
"allOf" => [
|
472
|
+
{ "$ref" => "http://json-schema.org/draft-04/schema#" }
|
473
|
+
]
|
474
|
+
}
|
475
|
+
schema2 = JsonSchema::Parser.new.parse!(sample2)
|
476
|
+
|
477
|
+
store = JsonSchema::DocumentStore.new
|
478
|
+
expander = JsonSchema::ReferenceExpander.new
|
479
|
+
|
480
|
+
store.add_schema(schema1)
|
481
|
+
store.add_schema(schema2)
|
482
|
+
|
483
|
+
expander.expand!(schema2, store: store)
|
484
|
+
|
485
|
+
assert schema1.expanded?
|
486
|
+
assert schema2.expanded?
|
487
|
+
end
|
488
|
+
|
457
489
|
it "it handles oneOf with nested references to a local schema" do
|
458
490
|
sample1 = {
|
459
491
|
"$schema" => "http://json-schema.org/draft-04/hyper-schema",
|
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: 0.20.
|
4
|
+
version: 0.20.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|