diff options
-rw-r--r-- | json/README.md | 1 | ||||
-rw-r--r-- | json/remotes/draft2019-09/dependentRequired.json | 7 | ||||
-rw-r--r-- | json/remotes/draft2019-09/ignore-prefixItems.json | 7 | ||||
-rw-r--r-- | json/remotes/draft2020-12/prefixItems.json | 7 | ||||
-rw-r--r-- | json/remotes/draft7/ignore-dependentRequired.json | 7 | ||||
-rw-r--r-- | json/tests/draft2019-09/optional/cross-draft.json | 41 | ||||
-rw-r--r-- | json/tests/draft2020-12/optional/cross-draft.json | 18 | ||||
-rw-r--r-- | json/tests/draft7/optional/cross-draft.json | 25 |
8 files changed, 113 insertions, 0 deletions
diff --git a/json/README.md b/json/README.md index d9cc165..efbed38 100644 --- a/json/README.md +++ b/json/README.md @@ -4,6 +4,7 @@ [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) [![Financial Contributors on Open Collective](https://opencollective.com/json-schema/all/badge.svg?label=financial+contributors)](https://opencollective.com/json-schema) +[![DOI](https://zenodo.org/badge/5952934.svg)](https://zenodo.org/badge/latestdoi/5952934) [![Build Status](https://github.com/json-schema-org/JSON-Schema-Test-Suite/workflows/Test%20Suite%20Sanity%20Checking/badge.svg)](https://github.com/json-schema-org/JSON-Schema-Test-Suite/actions?query=workflow%3A%22Test+Suite+Sanity+Checking%22) This repository contains a set of JSON objects that implementers of JSON Schema validation libraries can use to test their validators. diff --git a/json/remotes/draft2019-09/dependentRequired.json b/json/remotes/draft2019-09/dependentRequired.json new file mode 100644 index 0000000..0d691d9 --- /dev/null +++ b/json/remotes/draft2019-09/dependentRequired.json @@ -0,0 +1,7 @@ +{ + "$id": "http://localhost:1234/draft2019-09/dependentRequired.json", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "dependentRequired": { + "foo": ["bar"] + } +} diff --git a/json/remotes/draft2019-09/ignore-prefixItems.json b/json/remotes/draft2019-09/ignore-prefixItems.json new file mode 100644 index 0000000..b5ef392 --- /dev/null +++ b/json/remotes/draft2019-09/ignore-prefixItems.json @@ -0,0 +1,7 @@ +{ + "$id": "http://localhost:1234/draft2019-09/ignore-prefixItems.json", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "prefixItems": [ + {"type": "string"} + ] +} diff --git a/json/remotes/draft2020-12/prefixItems.json b/json/remotes/draft2020-12/prefixItems.json new file mode 100644 index 0000000..acd8293 --- /dev/null +++ b/json/remotes/draft2020-12/prefixItems.json @@ -0,0 +1,7 @@ +{ + "$id": "http://localhost:1234/draft2020-12/prefixItems.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "prefixItems": [ + {"type": "string"} + ] +} diff --git a/json/remotes/draft7/ignore-dependentRequired.json b/json/remotes/draft7/ignore-dependentRequired.json new file mode 100644 index 0000000..0ea927b --- /dev/null +++ b/json/remotes/draft7/ignore-dependentRequired.json @@ -0,0 +1,7 @@ +{ + "$id": "http://localhost:1234/draft7/integer.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "dependentRequired": { + "foo": ["bar"] + } +}
\ No newline at end of file diff --git a/json/tests/draft2019-09/optional/cross-draft.json b/json/tests/draft2019-09/optional/cross-draft.json new file mode 100644 index 0000000..efd3f87 --- /dev/null +++ b/json/tests/draft2019-09/optional/cross-draft.json @@ -0,0 +1,41 @@ +[ + { + "description": "refs to future drafts are processed as future drafts", + "schema": { + "$schema": "https://json-schema.org/draft/2019-09/schema", + "type": "array", + "$ref": "http://localhost:1234/draft2020-12/prefixItems.json" + }, + "tests": [ + { + "description": "first item not a string is invalid", + "comment": "if the implementation is not processing the $ref as a 2020-12 schema, this test will fail", + "data": [1, 2, 3], + "valid": false + }, + { + "description": "first item is a string is valid", + "data": ["a string", 1, 2, 3], + "valid": true + } + ] + }, + { + "description": "refs to historic drafts are processed as historic drafts", + "schema": { + "type": "object", + "allOf": [ + { "properties": { "foo": true } }, + { "$ref": "http://localhost:1234/draft7/ignore-dependentRequired.json" } + ] + }, + "tests": [ + { + "description": "missing bar is valid", + "comment": "if the implementation is not processing the $ref as a draft 7 schema, this test will fail", + "data": {"foo": "any value"}, + "valid": true + } + ] + } +] diff --git a/json/tests/draft2020-12/optional/cross-draft.json b/json/tests/draft2020-12/optional/cross-draft.json new file mode 100644 index 0000000..5113bd6 --- /dev/null +++ b/json/tests/draft2020-12/optional/cross-draft.json @@ -0,0 +1,18 @@ +[ + { + "description": "refs to historic drafts are processed as historic drafts", + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "$ref": "http://localhost:1234/draft2019-09/ignore-prefixItems.json" + }, + "tests": [ + { + "description": "first item not a string is valid", + "comment": "if the implementation is not processing the $ref as a 2019-09 schema, this test will fail", + "data": [1, 2, 3], + "valid": true + } + ] + } +] diff --git a/json/tests/draft7/optional/cross-draft.json b/json/tests/draft7/optional/cross-draft.json new file mode 100644 index 0000000..8ff5373 --- /dev/null +++ b/json/tests/draft7/optional/cross-draft.json @@ -0,0 +1,25 @@ +[ + { + "description": "refs to future drafts are processed as future drafts", + "schema": { + "type": "object", + "allOf": [ + { "properties": { "foo": true } }, + { "$ref": "http://localhost:1234/draft2019-09/dependentRequired.json" } + ] + }, + "tests": [ + { + "description": "missing bar is invalid", + "comment": "if the implementation is not processing the $ref as a 2019-09 schema, this test will fail", + "data": {"foo": "any value"}, + "valid": false + }, + { + "description": "present bar is valid", + "data": {"foo": "any value", "bar": "also any value"}, + "valid": true + } + ] + } +] |