diff options
author | Julian Berman <Julian@GrayVines.com> | 2022-08-16 09:35:23 +0300 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2022-08-16 09:35:23 +0300 |
commit | 74e91ee79990c28d937d54a6d2f9d18fd338af20 (patch) | |
tree | 40a3006a144b0fcc5e6b1ef9d53a6e444a0e095a | |
parent | 297cb8c4830ef4080d6ccf7ef7e0c0a4eb94342c (diff) | |
download | jsonschema-74e91ee79990c28d937d54a6d2f9d18fd338af20.tar.gz |
Squashed 'json/' changes from 597b1fb0d..b3c8672a3
b3c8672a3 Merge pull request #587 from json-schema-org/cross-draft-tests
e2a681ac6 $comment -> comment
52eb27902 add draft 2020-12 -> draft 2019-09 test
c4ed16dfe add draft 2019-09 -> draft 7 test
3df4712a9 add draft 2019-09 -> draft 2020-12 test
dab94face add draft 7 -> draft 2019-09 test
dfcea626f Merge pull request #584 from json-schema-org/doi
e4a59d962 Add a badge for a Zenodo DOI.
git-subtree-dir: json
git-subtree-split: b3c8672a3fa0a0691124e455680b34d5512cae94
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | remotes/draft2019-09/dependentRequired.json | 7 | ||||
-rw-r--r-- | remotes/draft2019-09/ignore-prefixItems.json | 7 | ||||
-rw-r--r-- | remotes/draft2020-12/prefixItems.json | 7 | ||||
-rw-r--r-- | remotes/draft7/ignore-dependentRequired.json | 7 | ||||
-rw-r--r-- | tests/draft2019-09/optional/cross-draft.json | 41 | ||||
-rw-r--r-- | tests/draft2020-12/optional/cross-draft.json | 18 | ||||
-rw-r--r-- | tests/draft7/optional/cross-draft.json | 25 |
8 files changed, 113 insertions, 0 deletions
@@ -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/remotes/draft2019-09/dependentRequired.json b/remotes/draft2019-09/dependentRequired.json new file mode 100644 index 0000000..0d691d9 --- /dev/null +++ b/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/remotes/draft2019-09/ignore-prefixItems.json b/remotes/draft2019-09/ignore-prefixItems.json new file mode 100644 index 0000000..b5ef392 --- /dev/null +++ b/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/remotes/draft2020-12/prefixItems.json b/remotes/draft2020-12/prefixItems.json new file mode 100644 index 0000000..acd8293 --- /dev/null +++ b/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/remotes/draft7/ignore-dependentRequired.json b/remotes/draft7/ignore-dependentRequired.json new file mode 100644 index 0000000..0ea927b --- /dev/null +++ b/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/tests/draft2019-09/optional/cross-draft.json b/tests/draft2019-09/optional/cross-draft.json new file mode 100644 index 0000000..efd3f87 --- /dev/null +++ b/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/tests/draft2020-12/optional/cross-draft.json b/tests/draft2020-12/optional/cross-draft.json new file mode 100644 index 0000000..5113bd6 --- /dev/null +++ b/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/tests/draft7/optional/cross-draft.json b/tests/draft7/optional/cross-draft.json new file mode 100644 index 0000000..8ff5373 --- /dev/null +++ b/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 + } + ] + } +] |