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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03e0e0136ad95f554577990c183117cf37641279202ee77cb9591abf23dbdc90
4
- data.tar.gz: 6ee750e3752bbe753d790f423b5bb2fdadd75c6878b0c6e3f06bac2e70320997
3
+ metadata.gz: c800e1fd6f5a28d53899ac7832439c0c6ec66d8c4948484f60e42c195a2bc247
4
+ data.tar.gz: 1da408588552c827c26ff7d9606e805fc04e9b0efa3000176d23439c20d791e8
5
5
  SHA512:
6
- metadata.gz: 76aa10dbefa5e67da46de6203858b4dda181761f7c896f55a77a6efb49f07b914ffbf3c92ddb11b49602f82b2091d4d78335a7f1ada8c9df7e8dfae806c7909e
7
- data.tar.gz: f874b4c7c2ddf0a8c1859388f6ac167f0150d69399c585402906af671f252e35185c43e9f2cfa67d298b42ee799359742a44e0f26f090c1b85053cd4a89884c9
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. Run the `release` task:
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.6
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-05-16 00:00:00.000000000 Z
11
+ date: 2019-07-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: