summaryrefslogtreecommitdiff
path: root/json/tests/draft-next/refRemote.json
diff options
context:
space:
mode:
Diffstat (limited to 'json/tests/draft-next/refRemote.json')
-rw-r--r--json/tests/draft-next/refRemote.json314
1 files changed, 314 insertions, 0 deletions
diff --git a/json/tests/draft-next/refRemote.json b/json/tests/draft-next/refRemote.json
new file mode 100644
index 0000000..3768b53
--- /dev/null
+++ b/json/tests/draft-next/refRemote.json
@@ -0,0 +1,314 @@
+[
+ {
+ "description": "remote ref",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$ref": "http://localhost:1234/draft-next/integer.json"
+ },
+ "tests": [
+ {
+ "description": "remote ref valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "remote ref invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "fragment within remote ref",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$ref": "http://localhost:1234/draft-next/subSchemas-defs.json#/$defs/integer"
+ },
+ "tests": [
+ {
+ "description": "remote fragment valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "remote fragment invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "anchor within remote ref",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$ref": "http://localhost:1234/draft-next/locationIndependentIdentifier.json#foo"
+ },
+ "tests": [
+ {
+ "description": "remote anchor valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "remote anchor invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "ref within remote ref",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$ref": "http://localhost:1234/draft-next/subSchemas-defs.json#/$defs/refToInteger"
+ },
+ "tests": [
+ {
+ "description": "ref within ref valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "ref within ref invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "base URI change",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$id": "http://localhost:1234/draft-next/",
+ "items": {
+ "$id": "baseUriChange/",
+ "items": {"$ref": "folderInteger.json"}
+ }
+ },
+ "tests": [
+ {
+ "description": "base URI change ref valid",
+ "data": [[1]],
+ "valid": true
+ },
+ {
+ "description": "base URI change ref invalid",
+ "data": [["a"]],
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "base URI change - change folder",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$id": "http://localhost:1234/draft-next/scope_change_defs1.json",
+ "type" : "object",
+ "properties": {"list": {"$ref": "baseUriChangeFolder/"}},
+ "$defs": {
+ "baz": {
+ "$id": "baseUriChangeFolder/",
+ "type": "array",
+ "items": {"$ref": "folderInteger.json"}
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": {"list": [1]},
+ "valid": true
+ },
+ {
+ "description": "string is invalid",
+ "data": {"list": ["a"]},
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "base URI change - change folder in subschema",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$id": "http://localhost:1234/draft-next/scope_change_defs2.json",
+ "type" : "object",
+ "properties": {"list": {"$ref": "baseUriChangeFolderInSubschema/#/$defs/bar"}},
+ "$defs": {
+ "baz": {
+ "$id": "baseUriChangeFolderInSubschema/",
+ "$defs": {
+ "bar": {
+ "type": "array",
+ "items": {"$ref": "folderInteger.json"}
+ }
+ }
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": {"list": [1]},
+ "valid": true
+ },
+ {
+ "description": "string is invalid",
+ "data": {"list": ["a"]},
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "root ref in remote ref",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$id": "http://localhost:1234/draft-next/object",
+ "type": "object",
+ "properties": {
+ "name": {"$ref": "name-defs.json#/$defs/orNull"}
+ }
+ },
+ "tests": [
+ {
+ "description": "string is valid",
+ "data": {
+ "name": "foo"
+ },
+ "valid": true
+ },
+ {
+ "description": "null is valid",
+ "data": {
+ "name": null
+ },
+ "valid": true
+ },
+ {
+ "description": "object is invalid",
+ "data": {
+ "name": {
+ "name": null
+ }
+ },
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "remote ref with ref to defs",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$id": "http://localhost:1234/draft-next/schema-remote-ref-ref-defs1.json",
+ "$ref": "ref-and-defs.json"
+ },
+ "tests": [
+ {
+ "description": "invalid",
+ "data": {
+ "bar": 1
+ },
+ "valid": false
+ },
+ {
+ "description": "valid",
+ "data": {
+ "bar": "a"
+ },
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "Location-independent identifier in remote ref",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$ref": "http://localhost:1234/draft-next/locationIndependentIdentifier.json#/$defs/refToInteger"
+ },
+ "tests": [
+ {
+ "description": "integer is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "string is invalid",
+ "data": "foo",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "retrieved nested refs resolve relative to their URI not $id",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$id": "http://localhost:1234/draft-next/some-id",
+ "properties": {
+ "name": {"$ref": "nested/foo-ref-string.json"}
+ }
+ },
+ "tests": [
+ {
+ "description": "number is invalid",
+ "data": {
+ "name": {"foo": 1}
+ },
+ "valid": false
+ },
+ {
+ "description": "string is valid",
+ "data": {
+ "name": {"foo": "a"}
+ },
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "remote HTTP ref with different $id",
+ "schema": {"$ref": "http://localhost:1234/different-id-ref-string.json"},
+ "tests": [
+ {
+ "description": "number is invalid",
+ "data": 1,
+ "valid": false
+ },
+ {
+ "description": "string is valid",
+ "data": "foo",
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "remote HTTP ref with different URN $id",
+ "schema": {"$ref": "http://localhost:1234/urn-ref-string.json"},
+ "tests": [
+ {
+ "description": "number is invalid",
+ "data": 1,
+ "valid": false
+ },
+ {
+ "description": "string is valid",
+ "data": "foo",
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "remote HTTP ref with nested absolute ref",
+ "schema": {"$ref": "http://localhost:1234/nested-absolute-ref-to-string.json"},
+ "tests": [
+ {
+ "description": "number is invalid",
+ "data": 1,
+ "valid": false
+ },
+ {
+ "description": "string is valid",
+ "data": "foo",
+ "valid": true
+ }
+ ]
+ }
+]