From f1b265ec87d8d8fbfba3e2552672faab5d87327f Mon Sep 17 00:00:00 2001 From: Shawn Silverman Date: Sat, 25 Apr 2020 08:51:10 -0700 Subject: [PATCH] [348] Add reference-to-unknown-keyword tests to earlier drafts Also renaming "reference of" to "reference to". --- ...nKeyword.json => refToUnknownKeyword.json} | 4 +- .../draft3/optional/refToUnknownKeyword.json | 44 +++++++++++++++++++ .../draft4/optional/refToUnknownKeyword.json | 44 +++++++++++++++++++ .../draft6/optional/refToUnknownKeyword.json | 44 +++++++++++++++++++ .../draft7/optional/refToUnknownKeyword.json | 44 +++++++++++++++++++ 5 files changed, 178 insertions(+), 2 deletions(-) rename tests/draft2019-09/optional/{refOfUnknownKeyword.json => refToUnknownKeyword.json} (89%) create mode 100644 tests/draft3/optional/refToUnknownKeyword.json create mode 100644 tests/draft4/optional/refToUnknownKeyword.json create mode 100644 tests/draft6/optional/refToUnknownKeyword.json create mode 100644 tests/draft7/optional/refToUnknownKeyword.json diff --git a/tests/draft2019-09/optional/refOfUnknownKeyword.json b/tests/draft2019-09/optional/refToUnknownKeyword.json similarity index 89% rename from tests/draft2019-09/optional/refOfUnknownKeyword.json rename to tests/draft2019-09/optional/refToUnknownKeyword.json index 5b150df8..3fc62588 100644 --- a/tests/draft2019-09/optional/refOfUnknownKeyword.json +++ b/tests/draft2019-09/optional/refToUnknownKeyword.json @@ -1,6 +1,6 @@ [ { - "description": "reference of a root arbitrary keyword ", + "description": "reference to a root arbitrary keyword ", "schema": { "unknown-keyword": {"type": "integer"}, "properties": { @@ -21,7 +21,7 @@ ] }, { - "description": "reference of an arbitrary keyword of a sub-schema", + "description": "reference to an arbitrary keyword of a sub-schema", "schema": { "properties": { "foo": {"unknown-keyword": {"type": "integer"}}, diff --git a/tests/draft3/optional/refToUnknownKeyword.json b/tests/draft3/optional/refToUnknownKeyword.json new file mode 100644 index 00000000..3fc62588 --- /dev/null +++ b/tests/draft3/optional/refToUnknownKeyword.json @@ -0,0 +1,44 @@ +[ + { + "description": "reference to a root arbitrary keyword ", + "schema": { + "unknown-keyword": {"type": "integer"}, + "properties": { + "bar": {"$ref": "#/unknown-keyword"} + } + }, + "tests": [ + { + "description": "match", + "data": {"bar": 3}, + "valid": true + }, + { + "description": "mismatch", + "data": {"bar": true}, + "valid": false + } + ] + }, + { + "description": "reference to an arbitrary keyword of a sub-schema", + "schema": { + "properties": { + "foo": {"unknown-keyword": {"type": "integer"}}, + "bar": {"$ref": "#/properties/foo/unknown-keyword"} + } + }, + "tests": [ + { + "description": "match", + "data": {"bar": 3}, + "valid": true + }, + { + "description": "mismatch", + "data": {"bar": true}, + "valid": false + } + ] + } +] diff --git a/tests/draft4/optional/refToUnknownKeyword.json b/tests/draft4/optional/refToUnknownKeyword.json new file mode 100644 index 00000000..3fc62588 --- /dev/null +++ b/tests/draft4/optional/refToUnknownKeyword.json @@ -0,0 +1,44 @@ +[ + { + "description": "reference to a root arbitrary keyword ", + "schema": { + "unknown-keyword": {"type": "integer"}, + "properties": { + "bar": {"$ref": "#/unknown-keyword"} + } + }, + "tests": [ + { + "description": "match", + "data": {"bar": 3}, + "valid": true + }, + { + "description": "mismatch", + "data": {"bar": true}, + "valid": false + } + ] + }, + { + "description": "reference to an arbitrary keyword of a sub-schema", + "schema": { + "properties": { + "foo": {"unknown-keyword": {"type": "integer"}}, + "bar": {"$ref": "#/properties/foo/unknown-keyword"} + } + }, + "tests": [ + { + "description": "match", + "data": {"bar": 3}, + "valid": true + }, + { + "description": "mismatch", + "data": {"bar": true}, + "valid": false + } + ] + } +] diff --git a/tests/draft6/optional/refToUnknownKeyword.json b/tests/draft6/optional/refToUnknownKeyword.json new file mode 100644 index 00000000..3fc62588 --- /dev/null +++ b/tests/draft6/optional/refToUnknownKeyword.json @@ -0,0 +1,44 @@ +[ + { + "description": "reference to a root arbitrary keyword ", + "schema": { + "unknown-keyword": {"type": "integer"}, + "properties": { + "bar": {"$ref": "#/unknown-keyword"} + } + }, + "tests": [ + { + "description": "match", + "data": {"bar": 3}, + "valid": true + }, + { + "description": "mismatch", + "data": {"bar": true}, + "valid": false + } + ] + }, + { + "description": "reference to an arbitrary keyword of a sub-schema", + "schema": { + "properties": { + "foo": {"unknown-keyword": {"type": "integer"}}, + "bar": {"$ref": "#/properties/foo/unknown-keyword"} + } + }, + "tests": [ + { + "description": "match", + "data": {"bar": 3}, + "valid": true + }, + { + "description": "mismatch", + "data": {"bar": true}, + "valid": false + } + ] + } +] diff --git a/tests/draft7/optional/refToUnknownKeyword.json b/tests/draft7/optional/refToUnknownKeyword.json new file mode 100644 index 00000000..3fc62588 --- /dev/null +++ b/tests/draft7/optional/refToUnknownKeyword.json @@ -0,0 +1,44 @@ +[ + { + "description": "reference to a root arbitrary keyword ", + "schema": { + "unknown-keyword": {"type": "integer"}, + "properties": { + "bar": {"$ref": "#/unknown-keyword"} + } + }, + "tests": [ + { + "description": "match", + "data": {"bar": 3}, + "valid": true + }, + { + "description": "mismatch", + "data": {"bar": true}, + "valid": false + } + ] + }, + { + "description": "reference to an arbitrary keyword of a sub-schema", + "schema": { + "properties": { + "foo": {"unknown-keyword": {"type": "integer"}}, + "bar": {"$ref": "#/properties/foo/unknown-keyword"} + } + }, + "tests": [ + { + "description": "match", + "data": {"bar": 3}, + "valid": true + }, + { + "description": "mismatch", + "data": {"bar": true}, + "valid": false + } + ] + } +]