diff options
author | Julian Berman <Julian@GrayVines.com> | 2021-06-26 08:44:14 +0200 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2021-06-26 08:44:14 +0200 |
commit | d0a2d44cb7bea2e3f1e29cb82414cf04e8813ff3 (patch) | |
tree | 5ca9c7cfd0b97a6cb7fd60c68f6b765cb8c8913f | |
parent | 35d38bbee7b4c4debb6b40e0370ed7cfa2609167 (diff) | |
parent | 4e76fb6ae3c1f77d12bca82e4f92691dd57cac15 (diff) | |
download | jsonschema-d0a2d44cb7bea2e3f1e29cb82414cf04e8813ff3.tar.gz |
Merge commit '4e76fb6ae3c1f77d12bca82e4f92691dd57cac15'
* commit '4e76fb6ae3c1f77d12bca82e4f92691dd57cac15':
Squashed 'json/' changes from 0aefbb3d..1326f36e
-rw-r--r-- | json/tests/draft3/ref.json | 36 | ||||
-rw-r--r-- | json/tests/draft4/ref.json | 36 | ||||
-rw-r--r-- | json/tests/draft6/ref.json | 36 | ||||
-rw-r--r-- | json/tests/draft6/refRemote.json | 4 | ||||
-rw-r--r-- | json/tests/draft7/ref.json | 36 | ||||
-rw-r--r-- | json/tests/draft7/refRemote.json | 4 |
6 files changed, 150 insertions, 2 deletions
diff --git a/json/tests/draft3/ref.json b/json/tests/draft3/ref.json index 26dcb52..760b771 100644 --- a/json/tests/draft3/ref.json +++ b/json/tests/draft3/ref.json @@ -201,6 +201,42 @@ ] }, { + "description": "$ref prevents a sibling $id from changing the base uri", + "schema": { + "$id": "http://localhost:1234/sibling_id/base/", + "definitions": { + "foo": { + "$id": "http://localhost:1234/sibling_id/foo.json", + "minimum": 2 + }, + "base_foo": { + "$comment": "this canonical uri is http://localhost:1234/sibling_id/base/foo.json", + "$id": "foo.json", + "minimum": 5 + } + }, + "allOf": [ + { + "$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not ttp://localhost:1234/sibling_id/foo.json", + "$id": "http://localhost:1234/sibling_id/", + "$ref": "foo.json" + } + ] + }, + "tests": [ + { + "description": "$ref resolves to /definitions/foo, data validates", + "data": 10, + "valid": true + }, + { + "description": "$ref resolves to /definitions/foo, data does not validate", + "data": 1, + "valid": false + } + ] + }, + { "description": "remote ref, containing refs itself", "schema": {"$ref": "http://json-schema.org/draft-03/schema#"}, "tests": [ diff --git a/json/tests/draft4/ref.json b/json/tests/draft4/ref.json index cc2ecf1..ae3770b 100644 --- a/json/tests/draft4/ref.json +++ b/json/tests/draft4/ref.json @@ -176,6 +176,42 @@ ] }, { + "description": "$ref prevents a sibling $id from changing the base uri", + "schema": { + "$id": "http://localhost:1234/sibling_id/base/", + "definitions": { + "foo": { + "$id": "http://localhost:1234/sibling_id/foo.json", + "minimum": 2 + }, + "base_foo": { + "$comment": "this canonical uri is http://localhost:1234/sibling_id/base/foo.json", + "$id": "foo.json", + "minimum": 5 + } + }, + "allOf": [ + { + "$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not ttp://localhost:1234/sibling_id/foo.json", + "$id": "http://localhost:1234/sibling_id/", + "$ref": "foo.json" + } + ] + }, + "tests": [ + { + "description": "$ref resolves to /definitions/foo, data validates", + "data": 10, + "valid": true + }, + { + "description": "$ref resolves to /definitions/foo, data does not validate", + "data": 1, + "valid": false + } + ] + }, + { "description": "remote ref, containing refs itself", "schema": {"$ref": "http://json-schema.org/draft-04/schema#"}, "tests": [ diff --git a/json/tests/draft6/ref.json b/json/tests/draft6/ref.json index 1fb426b..7780c3f 100644 --- a/json/tests/draft6/ref.json +++ b/json/tests/draft6/ref.json @@ -176,6 +176,42 @@ ] }, { + "description": "$ref prevents a sibling $id from changing the base uri", + "schema": { + "$id": "http://localhost:1234/sibling_id/base/", + "definitions": { + "foo": { + "$id": "http://localhost:1234/sibling_id/foo.json", + "minimum": 2 + }, + "base_foo": { + "$comment": "this canonical uri is http://localhost:1234/sibling_id/base/foo.json", + "$id": "foo.json", + "minimum": 5 + } + }, + "allOf": [ + { + "$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not ttp://localhost:1234/sibling_id/foo.json", + "$id": "http://localhost:1234/sibling_id/", + "$ref": "foo.json" + } + ] + }, + "tests": [ + { + "description": "$ref resolves to /definitions/foo, data validates", + "data": 10, + "valid": true + }, + { + "description": "$ref resolves to /definitions/foo, data does not validate", + "data": 1, + "valid": false + } + ] + }, + { "description": "remote ref, containing refs itself", "schema": {"$ref": "http://json-schema.org/draft-06/schema#"}, "tests": [ diff --git a/json/tests/draft6/refRemote.json b/json/tests/draft6/refRemote.json index 9d8057b..a2221b2 100644 --- a/json/tests/draft6/refRemote.json +++ b/json/tests/draft6/refRemote.json @@ -172,7 +172,9 @@ "description": "remote ref with ref to definitions", "schema": { "$id": "http://localhost:1234/schema-remote-ref-ref-defs1.json", - "$ref": "ref-and-definitions.json" + "allOf": [ + { "$ref": "ref-and-definitions.json" } + ] }, "tests": [ { diff --git a/json/tests/draft7/ref.json b/json/tests/draft7/ref.json index 406ae16..ff98d79 100644 --- a/json/tests/draft7/ref.json +++ b/json/tests/draft7/ref.json @@ -176,6 +176,42 @@ ] }, { + "description": "$ref prevents a sibling $id from changing the base uri", + "schema": { + "$id": "http://localhost:1234/sibling_id/base/", + "definitions": { + "foo": { + "$id": "http://localhost:1234/sibling_id/foo.json", + "minimum": 2 + }, + "base_foo": { + "$comment": "this canonical uri is http://localhost:1234/sibling_id/base/foo.json", + "$id": "foo.json", + "minimum": 5 + } + }, + "allOf": [ + { + "$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not ttp://localhost:1234/sibling_id/foo.json", + "$id": "http://localhost:1234/sibling_id/", + "$ref": "foo.json" + } + ] + }, + "tests": [ + { + "description": "$ref resolves to /definitions/foo, data validates", + "data": 10, + "valid": true + }, + { + "description": "$ref resolves to /definitions/foo, data does not validate", + "data": 1, + "valid": false + } + ] + }, + { "description": "remote ref, containing refs itself", "schema": {"$ref": "http://json-schema.org/draft-07/schema#"}, "tests": [ diff --git a/json/tests/draft7/refRemote.json b/json/tests/draft7/refRemote.json index 9d8057b..a2221b2 100644 --- a/json/tests/draft7/refRemote.json +++ b/json/tests/draft7/refRemote.json @@ -172,7 +172,9 @@ "description": "remote ref with ref to definitions", "schema": { "$id": "http://localhost:1234/schema-remote-ref-ref-defs1.json", - "$ref": "ref-and-definitions.json" + "allOf": [ + { "$ref": "ref-and-definitions.json" } + ] }, "tests": [ { |