summaryrefslogtreecommitdiff
path: root/tests/draft2019-09/dependentSchemas.json
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2020-03-04 15:40:25 -0500
committerJulian Berman <Julian@GrayVines.com>2020-03-04 15:40:25 -0500
commit11df97257859996434f37e33ad3d8cf2bd3606da (patch)
tree338fa40ca6349772170c72b9ef1e33d6472df24b /tests/draft2019-09/dependentSchemas.json
parentf7930d774c893cfae814a214d9b2ba0c01957928 (diff)
downloadjsonschema-11df97257859996434f37e33ad3d8cf2bd3606da.tar.gz
Squashed 'json/' changes from d52866b3..b70c5626
b70c5626 Merge remote-tracking branch 'origin/pr/323' 882688cb back out subSchemas.json changes, and instead add subSchemas-defs.json 0d6e1649 back out ref.json whitespace change and missing referant test 70ebd734 update subSchemas.json fixture in bin/jsonschema_suite b5123d1a In draft2019-09, you cannot reference arbitrary locations. 35041a34 Tests for unevaluatedItems. 8feb4292 More unevaluatedProperties tests. 960f519f Split dependencies.json into its 2 new keywords. git-subtree-dir: json git-subtree-split: b70c5626f3bea05064a8030e7c659d65cf4261f0
Diffstat (limited to 'tests/draft2019-09/dependentSchemas.json')
-rw-r--r--tests/draft2019-09/dependentSchemas.json114
1 files changed, 114 insertions, 0 deletions
diff --git a/tests/draft2019-09/dependentSchemas.json b/tests/draft2019-09/dependentSchemas.json
new file mode 100644
index 0000000..e7921d1
--- /dev/null
+++ b/tests/draft2019-09/dependentSchemas.json
@@ -0,0 +1,114 @@
+[
+ {
+ "description": "single dependency",
+ "schema": {
+ "dependentSchemas": {
+ "bar": {
+ "properties": {
+ "foo": {"type": "integer"},
+ "bar": {"type": "integer"}
+ }
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "valid",
+ "data": {"foo": 1, "bar": 2},
+ "valid": true
+ },
+ {
+ "description": "no dependency",
+ "data": {"foo": "quux"},
+ "valid": true
+ },
+ {
+ "description": "wrong type",
+ "data": {"foo": "quux", "bar": 2},
+ "valid": false
+ },
+ {
+ "description": "wrong type other",
+ "data": {"foo": 2, "bar": "quux"},
+ "valid": false
+ },
+ {
+ "description": "wrong type both",
+ "data": {"foo": "quux", "bar": "quux"},
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "boolean subschemas",
+ "schema": {
+ "dependentSchemas": {
+ "foo": true,
+ "bar": false
+ }
+ },
+ "tests": [
+ {
+ "description": "object with property having schema true is valid",
+ "data": {"foo": 1},
+ "valid": true
+ },
+ {
+ "description": "object with property having schema false is invalid",
+ "data": {"bar": 2},
+ "valid": false
+ },
+ {
+ "description": "object with both properties is invalid",
+ "data": {"foo": 1, "bar": 2},
+ "valid": false
+ },
+ {
+ "description": "empty object is valid",
+ "data": {},
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "dependencies with escaped characters",
+ "schema": {
+ "dependentSchemas": {
+ "foo\tbar": {"minProperties": 4},
+ "foo'bar": {"required": ["foo\"bar"]}
+ }
+ },
+ "tests": [
+ {
+ "description": "quoted tab",
+ "data": {
+ "foo\tbar": 1,
+ "a": 2,
+ "b": 3,
+ "c": 4
+ },
+ "valid": true
+ },
+ {
+ "description": "quoted quote",
+ "data": {
+ "foo'bar": {"foo\"bar": 1}
+ },
+ "valid": false
+ },
+ {
+ "description": "quoted tab invalid under dependent schema",
+ "data": {
+ "foo\tbar": 1,
+ "a": 2
+ },
+ "valid": false
+ },
+ {
+ "description": "quoted quote invalid under dependent schema",
+ "data": {"foo'bar": 1},
+ "valid": false
+ }
+ ]
+ }
+]