summaryrefslogtreecommitdiff
path: root/json/tests/draft-next/ref.json
diff options
context:
space:
mode:
Diffstat (limited to 'json/tests/draft-next/ref.json')
-rw-r--r--json/tests/draft-next/ref.json145
1 files changed, 111 insertions, 34 deletions
diff --git a/json/tests/draft-next/ref.json b/json/tests/draft-next/ref.json
index 6457e8a..1d5f256 100644
--- a/json/tests/draft-next/ref.json
+++ b/json/tests/draft-next/ref.json
@@ -601,16 +601,16 @@
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$comment": "$id must be evaluated before $ref to get the proper $ref destination",
- "$id": "/draft/next/ref-and-id1/base.json",
+ "$id": "https://example.com/draft/next/ref-and-id1/base.json",
"$ref": "int.json",
"$defs": {
"bigint": {
- "$comment": "canonical uri: /ref-and-id1/int.json",
+ "$comment": "canonical uri: https://example.com/ref-and-id1/int.json",
"$id": "int.json",
"maximum": 10
},
"smallint": {
- "$comment": "canonical uri: /ref-and-id1-int.json",
+ "$comment": "canonical uri: https://example.com/ref-and-id1-int.json",
"$id": "/draft/next/ref-and-id1-int.json",
"maximum": 2
}
@@ -634,16 +634,16 @@
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$comment": "$id must be evaluated before $ref to get the proper $ref destination",
- "$id": "/draft/next/ref-and-id2/base.json",
+ "$id": "https://example.com/draft/next/ref-and-id2/base.json",
"$ref": "#bigint",
"$defs": {
"bigint": {
- "$comment": "canonical uri: /ref-and-id2/base.json#/$defs/bigint; another valid uri for this location: /ref-and-id2/base.json#bigint",
+ "$comment": "canonical uri: https://example.com/ref-and-id2/base.json#/$defs/bigint; another valid uri for this location: https://example.com/ref-and-id2/base.json#bigint",
"$anchor": "bigint",
"maximum": 10
},
"smallint": {
- "$comment": "canonical uri: /ref-and-id2#/$defs/smallint; another valid uri for this location: /ref-and-id2/#bigint",
+ "$comment": "canonical uri: https://example.com/ref-and-id2#/$defs/smallint; another valid uri for this location: https://example.com/ref-and-id2/#bigint",
"$id": "/draft/next/ref-and-id2/",
"$anchor": "bigint",
"maximum": 2
@@ -951,32 +951,109 @@
]
},
{
- "description": "ref with absolute-path-reference",
- "schema": {
- "$id": "http://example.com/ref/absref.json",
- "$defs": {
- "a": {
- "$id": "http://example.com/ref/absref/foobar.json",
- "type": "number"
- },
- "b": {
- "$id": "http://example.com/absref/foobar.json",
- "type": "string"
- }
- },
- "$ref": "/absref/foobar.json"
- },
- "tests": [
- {
- "description": "a string is valid",
- "data": "foo",
- "valid": true
- },
- {
- "description": "an integer is invalid",
- "data": 12,
- "valid": false
- }
- ]
- }
+ "description": "ref with absolute-path-reference",
+ "schema": {
+ "$id": "http://example.com/ref/absref.json",
+ "$defs": {
+ "a": {
+ "$id": "http://example.com/ref/absref/foobar.json",
+ "type": "number"
+ },
+ "b": {
+ "$id": "http://example.com/absref/foobar.json",
+ "type": "string"
+ }
+ },
+ "$ref": "/absref/foobar.json"
+ },
+ "tests": [
+ {
+ "description": "a string is valid",
+ "data": "foo",
+ "valid": true
+ },
+ {
+ "description": "an integer is invalid",
+ "data": 12,
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "$id with file URI still resolves pointers - *nix",
+ "schema": {
+ "$id": "file:///folder/file.json",
+ "$defs": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "$ref": "#/$defs/foo"
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "$id with file URI still resolves pointers - windows",
+ "schema": {
+ "$id": "file:///c:/folder/file.json",
+ "$defs": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "$ref": "#/$defs/foo"
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "empty tokens in $ref json-pointer",
+ "schema": {
+ "$defs": {
+ "": {
+ "$defs": {
+ "": { "type": "number" }
+ }
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/$defs//$defs/"
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ }
]