summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2023-04-25 17:09:24 -0400
committerJulian Berman <Julian@GrayVines.com>2023-04-25 17:09:24 -0400
commit56fd2759e7c5a86d47fe2a9bcb60b8237a43f6d6 (patch)
treec16e531627618e3b33f87a566e0a71204d62323a
parentdc683c3105216f0c3fbfba78815b97f510e434c8 (diff)
parentb695cd7efa3e40fc41721792b4a692436b9eca39 (diff)
downloadjsonschema-56fd2759e7c5a86d47fe2a9bcb60b8237a43f6d6.tar.gz
Merge commit 'b695cd7efa3e40fc41721792b4a692436b9eca39'
* commit 'b695cd7efa3e40fc41721792b4a692436b9eca39': Squashed 'json/' changes from 0788c226a..6afa9b38d
-rwxr-xr-xjson/bin/jsonschema_suite14
-rw-r--r--json/output-tests/README.md8
-rw-r--r--json/output-tests/draft2019-09/content/escape.json38
-rw-r--r--json/output-tests/draft2019-09/output-schema.json2
-rw-r--r--json/output-tests/draft2020-12/content/escape.json38
-rw-r--r--json/tests/draft-next/dependentSchemas.json38
-rw-r--r--json/tests/draft-next/format.json95
-rw-r--r--json/tests/draft-next/ref.json145
-rw-r--r--json/tests/draft-next/unevaluatedItems.json23
-rw-r--r--json/tests/draft-next/unevaluatedProperties.json34
-rw-r--r--json/tests/draft-next/uniqueItems.json5
-rw-r--r--json/tests/draft2019-09/dependentSchemas.json38
-rw-r--r--json/tests/draft2019-09/recursiveRef.json4
-rw-r--r--json/tests/draft2019-09/ref.json89
-rw-r--r--json/tests/draft2019-09/unevaluatedItems.json23
-rw-r--r--json/tests/draft2019-09/unevaluatedProperties.json30
-rw-r--r--json/tests/draft2019-09/uniqueItems.json5
-rw-r--r--json/tests/draft2020-12/dependentSchemas.json38
-rw-r--r--json/tests/draft2020-12/format.json95
-rw-r--r--json/tests/draft2020-12/ref.json89
-rw-r--r--json/tests/draft2020-12/unevaluatedItems.json23
-rw-r--r--json/tests/draft2020-12/unevaluatedProperties.json30
-rw-r--r--json/tests/draft2020-12/uniqueItems.json5
-rw-r--r--json/tests/draft4/dependencies.json38
-rw-r--r--json/tests/draft4/ref.json85
-rw-r--r--json/tests/draft4/uniqueItems.json5
-rw-r--r--json/tests/draft6/dependencies.json38
-rw-r--r--json/tests/draft6/ref.json85
-rw-r--r--json/tests/draft6/uniqueItems.json5
-rw-r--r--json/tests/draft7/dependencies.json38
-rw-r--r--json/tests/draft7/ref.json85
-rw-r--r--json/tests/draft7/uniqueItems.json5
-rw-r--r--json/tox.ini2
33 files changed, 1239 insertions, 56 deletions
diff --git a/json/bin/jsonschema_suite b/json/bin/jsonschema_suite
index b4792a0..9fee8d7 100755
--- a/json/bin/jsonschema_suite
+++ b/json/bin/jsonschema_suite
@@ -498,6 +498,13 @@ class SanityTests(unittest.TestCase):
"title",
"type",
"uniqueItems",
+
+ # Technically this is wrong, $comment doesn't exist in this
+ # draft, but the point of this test is to detect mistakes by,
+ # test authors, whereas the point of the $comment keyword is
+ # to just standardize a place for a comment, so it's not a
+ # mistake to use it in earlier drafts in tests per se.
+ "$comment",
},
"draft3": {
"$ref",
@@ -528,6 +535,13 @@ class SanityTests(unittest.TestCase):
"title",
"type",
"uniqueItems",
+
+ # Technically this is wrong, $comment doesn't exist in this
+ # draft, but the point of this test is to detect mistakes by,
+ # test authors, whereas the point of the $comment keyword is
+ # to just standardize a place for a comment, so it's not a
+ # mistake to use it in earlier drafts in tests per se.
+ "$comment",
},
}
diff --git a/json/output-tests/README.md b/json/output-tests/README.md
index 0cd7c87..d209bdb 100644
--- a/json/output-tests/README.md
+++ b/json/output-tests/README.md
@@ -2,21 +2,21 @@ These tests are intended to validate that implementations are correctly generati
Output was initially specified with draft 2019-09. It remained largely unchanged for draft 2020-12, but will receive an update with the next release.
-***NOTE** Although the formats didn't change between 2019-09 and 2020-12, the tests are replicated for 2020-12 because the `$schema` is different and implementations may (but shouldn't) produce different output.*
+_**NOTE** Although the formats didn't change much between 2019-09 and 2020-12, the tests are copied for 2020-12 because the `$schema` is different and implementations may (but shouldn't) produce different output._
## Organization
The tests are organized by specification release and then into two categories: content and structure.
-Content tests verify that the keywords are producing the correct annotations and/or error messages. Since there are no requirements on the content of error messages, there's not much that can be verified for them, but it is possible to identify when a error message _could_ be present. Primarily, these tests need to extensively cover the annotation behaviors of each keyword. The only output format needed for these tests is `basic` for 2019-09/2020/12 and `list` for later versions.
+Content tests verify that the keywords are producing the correct annotations and/or error messages. Since there are no requirements on the content of error messages, there's not much that can be verified for them, but it is possible to identify when a error message _could_ be present. Primarily, these tests need to extensively cover the annotation behaviors of each keyword. The only output format needed for these tests is `basic` for 2019-09/2020-12 and `list` for later versions.
-Structure tests verify that the structures of the various formats (i.e. `flag`, `basic`, `detailed`, `verbose` for 2019/2020 and `flag`, `list`, `hierarchical` for later versions) are correct. These tests don't need to cover each keyword; rather they need to sufficiently cover the various aspects of building the output structures by using whatever keywords are necessary to do so.
+Structure tests verify that the structures of the various formats (i.e. `flag`, `basic`, `detailed`, `verbose` for 2019-09/2020-12 and `flag`, `list`, `hierarchical` for later versions) are correct. These tests don't need to cover each keyword; rather they need to sufficiently cover the various aspects of building the output structures by using whatever keywords are necessary to do so.
In each release folder, you'll also find an _output-schema.json_ file that contains the schema from the specification repo that describes output for that release. This schema will need to be loaded as the tests reference it.
## Test Files
-The content of a test file is the same as the validation tests in `tests/`, however an `output` property has been added to each test case.
+The content of a test file is similar to the validation tests in `tests/`: for each test case, the `valid` property has been removed, and an `output` property has been added.
The `output` property itself has a property for each of the output formats where the value is a schema that will successfully validate for compliant output. For the content tests, only `basic`/`list` needs to be present.
diff --git a/json/output-tests/draft2019-09/content/escape.json b/json/output-tests/draft2019-09/content/escape.json
new file mode 100644
index 0000000..d8cda15
--- /dev/null
+++ b/json/output-tests/draft2019-09/content/escape.json
@@ -0,0 +1,38 @@
+[
+ {
+ "description": "tilde and forward slash in json-pointer",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "$id": "https://json-schema.org/tests/content/draft2019-09/escape/0",
+ "properties": {
+ "~a/b": {"type": "number"}
+ }
+ },
+ "tests": [
+ {
+ "description": "incorrect type must be reported, but a message is not required",
+ "data": {"~a/b": "foobar"},
+ "output": {
+ "basic": {
+ "$id": "https://json-schema.org/tests/content/draft2019-09/escape/0/tests/0/basic",
+ "$ref": "/draft/2019-09/output/schema",
+ "properties": {
+ "errors": {
+ "contains": {
+ "properties": {
+ "keywordLocation": {"const": "/properties/~0a~1b/type"},
+ "absoluteKeywordLocation": {"const": "https://json-schema.org/tests/content/draft2019-09/escape/0#/properties/~0a~1b/type"},
+ "instanceLocation": {"const": "/~0a~1b"},
+ "annotation": false
+ },
+ "required": ["keywordLocation", "instanceLocation"]
+ }
+ }
+ },
+ "required": ["errors"]
+ }
+ }
+ }
+ ]
+ }
+]
diff --git a/json/output-tests/draft2019-09/output-schema.json b/json/output-tests/draft2019-09/output-schema.json
index 0a65f20..ff523ee 100644
--- a/json/output-tests/draft2019-09/output-schema.json
+++ b/json/output-tests/draft2019-09/output-schema.json
@@ -67,7 +67,7 @@
{
"properties": {
"keywordLocation": {
- "pattern": "/\\$dynamicRef/"
+ "pattern": "/\\$recursiveRef/"
}
}
}
diff --git a/json/output-tests/draft2020-12/content/escape.json b/json/output-tests/draft2020-12/content/escape.json
new file mode 100644
index 0000000..c329c91
--- /dev/null
+++ b/json/output-tests/draft2020-12/content/escape.json
@@ -0,0 +1,38 @@
+[
+ {
+ "description": "tilde and forward slash in json-pointer",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://json-schema.org/tests/content/draft2020-12/escape/0",
+ "properties": {
+ "~a/b": {"type": "number"}
+ }
+ },
+ "tests": [
+ {
+ "description": "incorrect type must be reported, but a message is not required",
+ "data": {"~a/b": "foobar"},
+ "output": {
+ "basic": {
+ "$id": "https://json-schema.org/tests/content/draft2020-12/escape/0/tests/0/basic",
+ "$ref": "/draft/2020-12/output/schema",
+ "properties": {
+ "errors": {
+ "contains": {
+ "properties": {
+ "keywordLocation": {"const": "/properties/~0a~1b/type"},
+ "absoluteKeywordLocation": {"const": "https://json-schema.org/tests/content/draft2020-12/escape/0#/properties/~0a~1b/type"},
+ "instanceLocation": {"const": "/~0a~1b"},
+ "annotation": false
+ },
+ "required": ["keywordLocation", "instanceLocation"]
+ }
+ }
+ },
+ "required": ["errors"]
+ }
+ }
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/dependentSchemas.json b/json/tests/draft-next/dependentSchemas.json
index 67c7979..8a84775 100644
--- a/json/tests/draft-next/dependentSchemas.json
+++ b/json/tests/draft-next/dependentSchemas.json
@@ -128,5 +128,43 @@
"valid": false
}
]
+ },
+ {
+ "description": "dependent subschema incompatible with root",
+ "schema": {
+ "properties": {
+ "foo": {}
+ },
+ "dependentSchemas": {
+ "foo": {
+ "properties": {
+ "bar": {}
+ },
+ "additionalProperties": false
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "matches root",
+ "data": {"foo": 1},
+ "valid": false
+ },
+ {
+ "description": "matches dependency",
+ "data": {"bar": 1},
+ "valid": true
+ },
+ {
+ "description": "matches both",
+ "data": {"foo": 1, "bar": 2},
+ "valid": false
+ },
+ {
+ "description": "no dependency",
+ "data": {"baz": 1},
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft-next/format.json b/json/tests/draft-next/format.json
index 43a8bd6..ec6c7f1 100644
--- a/json/tests/draft-next/format.json
+++ b/json/tests/draft-next/format.json
@@ -35,6 +35,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid email string is only an annotation by default",
+ "data": "2962",
+ "valid": true
}
]
},
@@ -74,6 +79,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid idn-email string is only an annotation by default",
+ "data": "2962",
+ "valid": true
}
]
},
@@ -113,6 +123,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid regex string is only an annotation by default",
+ "data": "^(abc]",
+ "valid": true
}
]
},
@@ -152,6 +167,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid ipv4 string is only an annotation by default",
+ "data": "127.0.0.0.1",
+ "valid": true
}
]
},
@@ -191,6 +211,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid ipv6 string is only an annotation by default",
+ "data": "12345::",
+ "valid": true
}
]
},
@@ -230,6 +255,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid idn-hostname string is only an annotation by default",
+ "data": "〮실례.테스트",
+ "valid": true
}
]
},
@@ -269,6 +299,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid hostname string is only an annotation by default",
+ "data": "-a-host-name-that-starts-with--",
+ "valid": true
}
]
},
@@ -308,6 +343,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid date string is only an annotation by default",
+ "data": "06/19/1963",
+ "valid": true
}
]
},
@@ -347,6 +387,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid date-time string is only an annotation by default",
+ "data": "1990-02-31T15:59:60.123-08:00",
+ "valid": true
}
]
},
@@ -386,6 +431,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid time string is only an annotation by default",
+ "data": "08:30:06 PST",
+ "valid": true
}
]
},
@@ -425,6 +475,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid json-pointer string is only an annotation by default",
+ "data": "/foo/bar~",
+ "valid": true
}
]
},
@@ -464,6 +519,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid relative-json-pointer string is only an annotation by default",
+ "data": "/foo/bar",
+ "valid": true
}
]
},
@@ -503,6 +563,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid iri string is only an annotation by default",
+ "data": "http://2001:0db8:85a3:0000:0000:8a2e:0370:7334",
+ "valid": true
}
]
},
@@ -542,6 +607,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid iri-reference string is only an annotation by default",
+ "data": "\\\\WINDOWS\\filëßåré",
+ "valid": true
}
]
},
@@ -581,6 +651,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid uri string is only an annotation by default",
+ "data": "//foo.bar/?baz=qux#quux",
+ "valid": true
}
]
},
@@ -620,6 +695,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid uri-reference string is only an annotation by default",
+ "data": "\\\\WINDOWS\\fileshare",
+ "valid": true
}
]
},
@@ -659,6 +739,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid uri-template string is only an annotation by default",
+ "data": "http://example.com/dictionary/{term:1}/{term",
+ "valid": true
}
]
},
@@ -698,6 +783,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid uuid string is only an annotation by default",
+ "data": "2eb8aa08-aa98-11ea-b4aa-73b441d1638",
+ "valid": true
}
]
},
@@ -737,6 +827,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid duration string is only an annotation by default",
+ "data": "PT1D",
+ "valid": true
}
]
}
diff --git a/json/tests/draft-next/ref.json b/json/tests/draft-next/ref.json
index 6457e8a..1d5f256 100644
--- a/json/tests/draft-next/ref.json
+++ b/json/tests/draft-next/ref.json
@@ -601,16 +601,16 @@
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$comment": "$id must be evaluated before $ref to get the proper $ref destination",
- "$id": "/draft/next/ref-and-id1/base.json",
+ "$id": "https://example.com/draft/next/ref-and-id1/base.json",
"$ref": "int.json",
"$defs": {
"bigint": {
- "$comment": "canonical uri: /ref-and-id1/int.json",
+ "$comment": "canonical uri: https://example.com/ref-and-id1/int.json",
"$id": "int.json",
"maximum": 10
},
"smallint": {
- "$comment": "canonical uri: /ref-and-id1-int.json",
+ "$comment": "canonical uri: https://example.com/ref-and-id1-int.json",
"$id": "/draft/next/ref-and-id1-int.json",
"maximum": 2
}
@@ -634,16 +634,16 @@
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$comment": "$id must be evaluated before $ref to get the proper $ref destination",
- "$id": "/draft/next/ref-and-id2/base.json",
+ "$id": "https://example.com/draft/next/ref-and-id2/base.json",
"$ref": "#bigint",
"$defs": {
"bigint": {
- "$comment": "canonical uri: /ref-and-id2/base.json#/$defs/bigint; another valid uri for this location: /ref-and-id2/base.json#bigint",
+ "$comment": "canonical uri: https://example.com/ref-and-id2/base.json#/$defs/bigint; another valid uri for this location: https://example.com/ref-and-id2/base.json#bigint",
"$anchor": "bigint",
"maximum": 10
},
"smallint": {
- "$comment": "canonical uri: /ref-and-id2#/$defs/smallint; another valid uri for this location: /ref-and-id2/#bigint",
+ "$comment": "canonical uri: https://example.com/ref-and-id2#/$defs/smallint; another valid uri for this location: https://example.com/ref-and-id2/#bigint",
"$id": "/draft/next/ref-and-id2/",
"$anchor": "bigint",
"maximum": 2
@@ -951,32 +951,109 @@
]
},
{
- "description": "ref with absolute-path-reference",
- "schema": {
- "$id": "http://example.com/ref/absref.json",
- "$defs": {
- "a": {
- "$id": "http://example.com/ref/absref/foobar.json",
- "type": "number"
- },
- "b": {
- "$id": "http://example.com/absref/foobar.json",
- "type": "string"
- }
- },
- "$ref": "/absref/foobar.json"
- },
- "tests": [
- {
- "description": "a string is valid",
- "data": "foo",
- "valid": true
- },
- {
- "description": "an integer is invalid",
- "data": 12,
- "valid": false
- }
- ]
- }
+ "description": "ref with absolute-path-reference",
+ "schema": {
+ "$id": "http://example.com/ref/absref.json",
+ "$defs": {
+ "a": {
+ "$id": "http://example.com/ref/absref/foobar.json",
+ "type": "number"
+ },
+ "b": {
+ "$id": "http://example.com/absref/foobar.json",
+ "type": "string"
+ }
+ },
+ "$ref": "/absref/foobar.json"
+ },
+ "tests": [
+ {
+ "description": "a string is valid",
+ "data": "foo",
+ "valid": true
+ },
+ {
+ "description": "an integer is invalid",
+ "data": 12,
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "$id with file URI still resolves pointers - *nix",
+ "schema": {
+ "$id": "file:///folder/file.json",
+ "$defs": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "$ref": "#/$defs/foo"
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "$id with file URI still resolves pointers - windows",
+ "schema": {
+ "$id": "file:///c:/folder/file.json",
+ "$defs": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "$ref": "#/$defs/foo"
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "empty tokens in $ref json-pointer",
+ "schema": {
+ "$defs": {
+ "": {
+ "$defs": {
+ "": { "type": "number" }
+ }
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/$defs//$defs/"
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ }
]
diff --git a/json/tests/draft-next/unevaluatedItems.json b/json/tests/draft-next/unevaluatedItems.json
index ce5d043..7379afb 100644
--- a/json/tests/draft-next/unevaluatedItems.json
+++ b/json/tests/draft-next/unevaluatedItems.json
@@ -692,5 +692,28 @@
"valid": true
}
]
+ },
+ {
+ "description": "unevaluatedItems can see annotations from if without then and else",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "if": {
+ "prefixItems": [{"const": "a"}]
+ },
+ "unevaluatedItems": false
+ },
+ "tests": [
+ {
+ "description": "valid in case if is evaluated",
+ "data": [ "a" ],
+ "valid": true
+ },
+ {
+ "description": "invalid in case if is evaluated",
+ "data": [ "b" ],
+ "valid": false
+ }
+
+ ]
}
]
diff --git a/json/tests/draft-next/unevaluatedProperties.json b/json/tests/draft-next/unevaluatedProperties.json
index f3d4012..69fe8a0 100644
--- a/json/tests/draft-next/unevaluatedProperties.json
+++ b/json/tests/draft-next/unevaluatedProperties.json
@@ -1232,7 +1232,7 @@
]
},
{
- "description": "dynamic evalation inside nested refs",
+ "description": "dynamic evaluation inside nested refs",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$defs": {
@@ -1482,7 +1482,7 @@
},
"propertyDependencies": {
"foo": {
- "foo1": {
+ "foo1": {
"properties": {
"bar": true
}
@@ -1538,5 +1538,35 @@
"valid": false
}
]
+ },
+ {
+ "description": "unevaluatedProperties can see annotations from if without then and else",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "if": {
+ "patternProperties": {
+ "foo": {
+ "type": "string"
+ }
+ }
+ },
+ "unevaluatedProperties": false
+ },
+ "tests": [
+ {
+ "description": "valid in case if is evaluated",
+ "data": {
+ "foo": "a"
+ },
+ "valid": true
+ },
+ {
+ "description": "invalid in case if is evaluated",
+ "data": {
+ "bar": "a"
+ },
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft-next/uniqueItems.json b/json/tests/draft-next/uniqueItems.json
index 610b257..b16dd50 100644
--- a/json/tests/draft-next/uniqueItems.json
+++ b/json/tests/draft-next/uniqueItems.json
@@ -57,6 +57,11 @@
"valid": false
},
{
+ "description": "property order of array of objects is ignored",
+ "data": [{"foo": "bar", "bar": "foo"}, {"bar": "foo", "foo": "bar"}],
+ "valid": false
+ },
+ {
"description": "unique array of nested objects is valid",
"data": [
{"foo": {"bar" : {"baz" : true}}},
diff --git a/json/tests/draft2019-09/dependentSchemas.json b/json/tests/draft2019-09/dependentSchemas.json
index b397583..3577efd 100644
--- a/json/tests/draft2019-09/dependentSchemas.json
+++ b/json/tests/draft2019-09/dependentSchemas.json
@@ -128,5 +128,43 @@
"valid": false
}
]
+ },
+ {
+ "description": "dependent subschema incompatible with root",
+ "schema": {
+ "properties": {
+ "foo": {}
+ },
+ "dependentSchemas": {
+ "foo": {
+ "properties": {
+ "bar": {}
+ },
+ "additionalProperties": false
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "matches root",
+ "data": {"foo": 1},
+ "valid": false
+ },
+ {
+ "description": "matches dependency",
+ "data": {"bar": 1},
+ "valid": true
+ },
+ {
+ "description": "matches both",
+ "data": {"foo": 1, "bar": 2},
+ "valid": false
+ },
+ {
+ "description": "no dependency",
+ "data": {"baz": 1},
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft2019-09/recursiveRef.json b/json/tests/draft2019-09/recursiveRef.json
index 1e713ff..22b47e7 100644
--- a/json/tests/draft2019-09/recursiveRef.json
+++ b/json/tests/draft2019-09/recursiveRef.json
@@ -318,7 +318,7 @@
"description": "multiple dynamic paths to the $recursiveRef keyword",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
- "$id": "recursiveRef8_main.json",
+ "$id": "https://example.com/recursiveRef8_main.json",
"$defs": {
"inner": {
"$id": "recursiveRef8_inner.json",
@@ -365,7 +365,7 @@
"description": "dynamic $recursiveRef destination (not predictable at schema compile time)",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
- "$id": "main.json",
+ "$id": "https://example.com/main.json",
"$defs": {
"inner": {
"$id": "inner.json",
diff --git a/json/tests/draft2019-09/ref.json b/json/tests/draft2019-09/ref.json
index d420bd9..7d85041 100644
--- a/json/tests/draft2019-09/ref.json
+++ b/json/tests/draft2019-09/ref.json
@@ -601,16 +601,16 @@
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$comment": "$id must be evaluated before $ref to get the proper $ref destination",
- "$id": "/draft2019-09/ref-and-id1/base.json",
+ "$id": "https://example.com/draft2019-09/ref-and-id1/base.json",
"$ref": "int.json",
"$defs": {
"bigint": {
- "$comment": "canonical uri: /draft2019-09/ref-and-id1/int.json",
+ "$comment": "canonical uri: https://example.com/draft2019-09/ref-and-id1/int.json",
"$id": "int.json",
"maximum": 10
},
"smallint": {
- "$comment": "canonical uri: /draft2019-09/ref-and-id1-int.json",
+ "$comment": "canonical uri: https://example.com/draft2019-09/ref-and-id1-int.json",
"$id": "/draft2019-09/ref-and-id1-int.json",
"maximum": 2
}
@@ -634,16 +634,16 @@
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$comment": "$id must be evaluated before $ref to get the proper $ref destination",
- "$id": "/draft2019-09/ref-and-id2/base.json",
+ "$id": "https://example.com/draft2019-09/ref-and-id2/base.json",
"$ref": "#bigint",
"$defs": {
"bigint": {
- "$comment": "canonical uri: /draft2019-09/ref-and-id2/base.json#/$defs/bigint; another valid uri for this location: /ref-and-id2/base.json#bigint",
+ "$comment": "canonical uri: https://example.com/draft2019-09/ref-and-id2/base.json#/$defs/bigint; another valid uri for this location: https://example.com/ref-and-id2/base.json#bigint",
"$anchor": "bigint",
"maximum": 10
},
"smallint": {
- "$comment": "canonical uri: /draft2019-09/ref-and-id2#/$defs/smallint; another valid uri for this location: /ref-and-id2/#bigint",
+ "$comment": "canonical uri: https://example.com/draft2019-09/ref-and-id2#/$defs/smallint; another valid uri for this location: https://example.com/ref-and-id2/#bigint",
"$id": "/draft2019-09/ref-and-id2/",
"$anchor": "bigint",
"maximum": 2
@@ -978,5 +978,82 @@
"valid": false
}
]
+ },
+ {
+ "description": "$id with file URI still resolves pointers - *nix",
+ "schema": {
+ "$id": "file:///folder/file.json",
+ "$defs": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "$ref": "#/$defs/foo"
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "$id with file URI still resolves pointers - windows",
+ "schema": {
+ "$id": "file:///c:/folder/file.json",
+ "$defs": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "$ref": "#/$defs/foo"
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "empty tokens in $ref json-pointer",
+ "schema": {
+ "$defs": {
+ "": {
+ "$defs": {
+ "": { "type": "number" }
+ }
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/$defs//$defs/"
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft2019-09/unevaluatedItems.json b/json/tests/draft2019-09/unevaluatedItems.json
index a0b1f33..53565a0 100644
--- a/json/tests/draft2019-09/unevaluatedItems.json
+++ b/json/tests/draft2019-09/unevaluatedItems.json
@@ -600,5 +600,28 @@
"valid": true
}
]
+ },
+ {
+ "description": "unevaluatedItems can see annotations from if without then and else",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "if": {
+ "items": [{"const": "a"}]
+ },
+ "unevaluatedItems": false
+ },
+ "tests": [
+ {
+ "description": "valid in case if is evaluated",
+ "data": [ "a" ],
+ "valid": true
+ },
+ {
+ "description": "invalid in case if is evaluated",
+ "data": [ "b" ],
+ "valid": false
+ }
+
+ ]
}
]
diff --git a/json/tests/draft2019-09/unevaluatedProperties.json b/json/tests/draft2019-09/unevaluatedProperties.json
index fdb4ac9..a6cce8b 100644
--- a/json/tests/draft2019-09/unevaluatedProperties.json
+++ b/json/tests/draft2019-09/unevaluatedProperties.json
@@ -1441,5 +1441,35 @@
"valid": false
}
]
+ },
+ {
+ "description": "unevaluatedProperties can see annotations from if without then and else",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "if": {
+ "patternProperties": {
+ "foo": {
+ "type": "string"
+ }
+ }
+ },
+ "unevaluatedProperties": false
+ },
+ "tests": [
+ {
+ "description": "valid in case if is evaluated",
+ "data": {
+ "foo": "a"
+ },
+ "valid": true
+ },
+ {
+ "description": "invalid in case if is evaluated",
+ "data": {
+ "bar": "a"
+ },
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft2019-09/uniqueItems.json b/json/tests/draft2019-09/uniqueItems.json
index 6da878b..314b4b9 100644
--- a/json/tests/draft2019-09/uniqueItems.json
+++ b/json/tests/draft2019-09/uniqueItems.json
@@ -57,6 +57,11 @@
"valid": false
},
{
+ "description": "property order of array of objects is ignored",
+ "data": [{"foo": "bar", "bar": "foo"}, {"bar": "foo", "foo": "bar"}],
+ "valid": false
+ },
+ {
"description": "unique array of nested objects is valid",
"data": [
{"foo": {"bar" : {"baz" : true}}},
diff --git a/json/tests/draft2020-12/dependentSchemas.json b/json/tests/draft2020-12/dependentSchemas.json
index bf7aa53..66ac0eb 100644
--- a/json/tests/draft2020-12/dependentSchemas.json
+++ b/json/tests/draft2020-12/dependentSchemas.json
@@ -128,5 +128,43 @@
"valid": false
}
]
+ },
+ {
+ "description": "dependent subschema incompatible with root",
+ "schema": {
+ "properties": {
+ "foo": {}
+ },
+ "dependentSchemas": {
+ "foo": {
+ "properties": {
+ "bar": {}
+ },
+ "additionalProperties": false
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "matches root",
+ "data": {"foo": 1},
+ "valid": false
+ },
+ {
+ "description": "matches dependency",
+ "data": {"bar": 1},
+ "valid": true
+ },
+ {
+ "description": "matches both",
+ "data": {"foo": 1, "bar": 2},
+ "valid": false
+ },
+ {
+ "description": "no dependency",
+ "data": {"baz": 1},
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft2020-12/format.json b/json/tests/draft2020-12/format.json
index 6b7904e..01adcbd 100644
--- a/json/tests/draft2020-12/format.json
+++ b/json/tests/draft2020-12/format.json
@@ -35,6 +35,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid email string is only an annotation by default",
+ "data": "2962",
+ "valid": true
}
]
},
@@ -74,6 +79,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid idn-email string is only an annotation by default",
+ "data": "2962",
+ "valid": true
}
]
},
@@ -113,6 +123,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid regex string is only an annotation by default",
+ "data": "^(abc]",
+ "valid": true
}
]
},
@@ -152,6 +167,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid ipv4 string is only an annotation by default",
+ "data": "127.0.0.0.1",
+ "valid": true
}
]
},
@@ -191,6 +211,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid ipv6 string is only an annotation by default",
+ "data": "12345::",
+ "valid": true
}
]
},
@@ -230,6 +255,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid idn-hostname string is only an annotation by default",
+ "data": "〮실례.테스트",
+ "valid": true
}
]
},
@@ -269,6 +299,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid hostname string is only an annotation by default",
+ "data": "-a-host-name-that-starts-with--",
+ "valid": true
}
]
},
@@ -308,6 +343,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid date string is only an annotation by default",
+ "data": "06/19/1963",
+ "valid": true
}
]
},
@@ -347,6 +387,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid date-time string is only an annotation by default",
+ "data": "1990-02-31T15:59:60.123-08:00",
+ "valid": true
}
]
},
@@ -386,6 +431,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid time string is only an annotation by default",
+ "data": "08:30:06 PST",
+ "valid": true
}
]
},
@@ -425,6 +475,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid json-pointer string is only an annotation by default",
+ "data": "/foo/bar~",
+ "valid": true
}
]
},
@@ -464,6 +519,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid relative-json-pointer string is only an annotation by default",
+ "data": "/foo/bar",
+ "valid": true
}
]
},
@@ -503,6 +563,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid iri string is only an annotation by default",
+ "data": "http://2001:0db8:85a3:0000:0000:8a2e:0370:7334",
+ "valid": true
}
]
},
@@ -542,6 +607,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid iri-reference string is only an annotation by default",
+ "data": "\\\\WINDOWS\\filëßåré",
+ "valid": true
}
]
},
@@ -581,6 +651,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid uri string is only an annotation by default",
+ "data": "//foo.bar/?baz=qux#quux",
+ "valid": true
}
]
},
@@ -620,6 +695,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid uri-reference string is only an annotation by default",
+ "data": "\\\\WINDOWS\\fileshare",
+ "valid": true
}
]
},
@@ -659,6 +739,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid uri-template string is only an annotation by default",
+ "data": "http://example.com/dictionary/{term:1}/{term",
+ "valid": true
}
]
},
@@ -698,6 +783,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid uuid string is only an annotation by default",
+ "data": "2eb8aa08-aa98-11ea-b4aa-73b441d1638",
+ "valid": true
}
]
},
@@ -737,6 +827,11 @@
"description": "all string formats ignore nulls",
"data": null,
"valid": true
+ },
+ {
+ "description": "invalid duration string is only an annotation by default",
+ "data": "PT1D",
+ "valid": true
}
]
}
diff --git a/json/tests/draft2020-12/ref.json b/json/tests/draft2020-12/ref.json
index 72c593a..5f6be8c 100644
--- a/json/tests/draft2020-12/ref.json
+++ b/json/tests/draft2020-12/ref.json
@@ -601,16 +601,16 @@
"schema": {
"$comment": "$id must be evaluated before $ref to get the proper $ref destination",
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "$id": "/draft2020-12/ref-and-id1/base.json",
+ "$id": "https://example.com/draft2020-12/ref-and-id1/base.json",
"$ref": "int.json",
"$defs": {
"bigint": {
- "$comment": "canonical uri: /ref-and-id1/int.json",
+ "$comment": "canonical uri: https://example.com/ref-and-id1/int.json",
"$id": "int.json",
"maximum": 10
},
"smallint": {
- "$comment": "canonical uri: /ref-and-id1-int.json",
+ "$comment": "canonical uri: https://example.com/ref-and-id1-int.json",
"$id": "/draft2020-12/ref-and-id1-int.json",
"maximum": 2
}
@@ -634,7 +634,7 @@
"schema": {
"$comment": "$id must be evaluated before $ref to get the proper $ref destination",
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "$id": "/draft2020-12/ref-and-id2/base.json",
+ "$id": "https://example.com/draft2020-12/ref-and-id2/base.json",
"$ref": "#bigint",
"$defs": {
"bigint": {
@@ -643,8 +643,8 @@
"maximum": 10
},
"smallint": {
- "$comment": "canonical uri: /ref-and-id2#/$defs/smallint; another valid uri for this location: /ref-and-id2/#bigint",
- "$id": "/draft2020-12/ref-and-id2/",
+ "$comment": "canonical uri: https://example.com/ref-and-id2#/$defs/smallint; another valid uri for this location: https://example.com/ref-and-id2/#bigint",
+ "$id": "https://example.com/draft2020-12/ref-and-id2/",
"$anchor": "bigint",
"maximum": 2
}
@@ -978,5 +978,82 @@
"valid": false
}
]
+ },
+ {
+ "description": "$id with file URI still resolves pointers - *nix",
+ "schema": {
+ "$id": "file:///folder/file.json",
+ "$defs": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "$ref": "#/$defs/foo"
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "$id with file URI still resolves pointers - windows",
+ "schema": {
+ "$id": "file:///c:/folder/file.json",
+ "$defs": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "$ref": "#/$defs/foo"
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "empty tokens in $ref json-pointer",
+ "schema": {
+ "$defs": {
+ "": {
+ "$defs": {
+ "": { "type": "number" }
+ }
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/$defs//$defs/"
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft2020-12/unevaluatedItems.json b/json/tests/draft2020-12/unevaluatedItems.json
index 2b816af..2615c4c 100644
--- a/json/tests/draft2020-12/unevaluatedItems.json
+++ b/json/tests/draft2020-12/unevaluatedItems.json
@@ -692,5 +692,28 @@
"valid": true
}
]
+ },
+ {
+ "description": "unevaluatedItems can see annotations from if without then and else",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "if": {
+ "prefixItems": [{"const": "a"}]
+ },
+ "unevaluatedItems": false
+ },
+ "tests": [
+ {
+ "description": "valid in case if is evaluated",
+ "data": [ "a" ],
+ "valid": true
+ },
+ {
+ "description": "invalid in case if is evaluated",
+ "data": [ "b" ],
+ "valid": false
+ }
+
+ ]
}
]
diff --git a/json/tests/draft2020-12/unevaluatedProperties.json b/json/tests/draft2020-12/unevaluatedProperties.json
index 00cb36c..f7fb420 100644
--- a/json/tests/draft2020-12/unevaluatedProperties.json
+++ b/json/tests/draft2020-12/unevaluatedProperties.json
@@ -1441,5 +1441,35 @@
"valid": false
}
]
+ },
+ {
+ "description": "unevaluatedProperties can see annotations from if without then and else",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "if": {
+ "patternProperties": {
+ "foo": {
+ "type": "string"
+ }
+ }
+ },
+ "unevaluatedProperties": false
+ },
+ "tests": [
+ {
+ "description": "valid in case if is evaluated",
+ "data": {
+ "foo": "a"
+ },
+ "valid": true
+ },
+ {
+ "description": "invalid in case if is evaluated",
+ "data": {
+ "bar": "a"
+ },
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft2020-12/uniqueItems.json b/json/tests/draft2020-12/uniqueItems.json
index 707235c..4ea3bf9 100644
--- a/json/tests/draft2020-12/uniqueItems.json
+++ b/json/tests/draft2020-12/uniqueItems.json
@@ -57,6 +57,11 @@
"valid": false
},
{
+ "description": "property order of array of objects is ignored",
+ "data": [{"foo": "bar", "bar": "foo"}, {"bar": "foo", "foo": "bar"}],
+ "valid": false
+ },
+ {
"description": "unique array of nested objects is valid",
"data": [
{"foo": {"bar" : {"baz" : true}}},
diff --git a/json/tests/draft4/dependencies.json b/json/tests/draft4/dependencies.json
index 51eeddf..9045ddc 100644
--- a/json/tests/draft4/dependencies.json
+++ b/json/tests/draft4/dependencies.json
@@ -190,5 +190,43 @@
"valid": false
}
]
+ },
+ {
+ "description": "dependent subschema incompatible with root",
+ "schema": {
+ "properties": {
+ "foo": {}
+ },
+ "dependencies": {
+ "foo": {
+ "properties": {
+ "bar": {}
+ },
+ "additionalProperties": false
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "matches root",
+ "data": {"foo": 1},
+ "valid": false
+ },
+ {
+ "description": "matches dependency",
+ "data": {"bar": 1},
+ "valid": true
+ },
+ {
+ "description": "matches both",
+ "data": {"foo": 1, "bar": 2},
+ "valid": false
+ },
+ {
+ "description": "no dependency",
+ "data": {"baz": 1},
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft4/ref.json b/json/tests/draft4/ref.json
index b714fb0..b53bd2a 100644
--- a/json/tests/draft4/ref.json
+++ b/json/tests/draft4/ref.json
@@ -503,5 +503,90 @@
"valid": false
}
]
+ },
+ {
+ "description": "id with file URI still resolves pointers - *nix",
+ "schema": {
+ "id": "file:///folder/file.json",
+ "definitions": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/definitions/foo"
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "id with file URI still resolves pointers - windows",
+ "schema": {
+ "id": "file:///c:/folder/file.json",
+ "definitions": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/definitions/foo"
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "empty tokens in $ref json-pointer",
+ "schema": {
+ "definitions": {
+ "": {
+ "definitions": {
+ "": { "type": "number" }
+ }
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/definitions//definitions/"
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft4/uniqueItems.json b/json/tests/draft4/uniqueItems.json
index 2ccf666..d2730c6 100644
--- a/json/tests/draft4/uniqueItems.json
+++ b/json/tests/draft4/uniqueItems.json
@@ -54,6 +54,11 @@
"valid": false
},
{
+ "description": "property order of array of objects is ignored",
+ "data": [{"foo": "bar", "bar": "foo"}, {"bar": "foo", "foo": "bar"}],
+ "valid": false
+ },
+ {
"description": "unique array of nested objects is valid",
"data": [
{"foo": {"bar" : {"baz" : true}}},
diff --git a/json/tests/draft6/dependencies.json b/json/tests/draft6/dependencies.json
index a5e5428..c0bd809 100644
--- a/json/tests/draft6/dependencies.json
+++ b/json/tests/draft6/dependencies.json
@@ -244,5 +244,43 @@
"valid": false
}
]
+ },
+ {
+ "description": "dependent subschema incompatible with root",
+ "schema": {
+ "properties": {
+ "foo": {}
+ },
+ "dependencies": {
+ "foo": {
+ "properties": {
+ "bar": {}
+ },
+ "additionalProperties": false
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "matches root",
+ "data": {"foo": 1},
+ "valid": false
+ },
+ {
+ "description": "matches dependency",
+ "data": {"bar": 1},
+ "valid": true
+ },
+ {
+ "description": "matches both",
+ "data": {"foo": 1, "bar": 2},
+ "valid": false
+ },
+ {
+ "description": "no dependency",
+ "data": {"baz": 1},
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft6/ref.json b/json/tests/draft6/ref.json
index 8a36593..8a8908a 100644
--- a/json/tests/draft6/ref.json
+++ b/json/tests/draft6/ref.json
@@ -813,5 +813,90 @@
"valid": false
}
]
+ },
+ {
+ "description": "$id with file URI still resolves pointers - *nix",
+ "schema": {
+ "$id": "file:///folder/file.json",
+ "definitions": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/definitions/foo"
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "$id with file URI still resolves pointers - windows",
+ "schema": {
+ "$id": "file:///c:/folder/file.json",
+ "definitions": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/definitions/foo"
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "empty tokens in $ref json-pointer",
+ "schema": {
+ "definitions": {
+ "": {
+ "definitions": {
+ "": { "type": "number" }
+ }
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/definitions//definitions/"
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft6/uniqueItems.json b/json/tests/draft6/uniqueItems.json
index 2ccf666..d2730c6 100644
--- a/json/tests/draft6/uniqueItems.json
+++ b/json/tests/draft6/uniqueItems.json
@@ -54,6 +54,11 @@
"valid": false
},
{
+ "description": "property order of array of objects is ignored",
+ "data": [{"foo": "bar", "bar": "foo"}, {"bar": "foo", "foo": "bar"}],
+ "valid": false
+ },
+ {
"description": "unique array of nested objects is valid",
"data": [
{"foo": {"bar" : {"baz" : true}}},
diff --git a/json/tests/draft7/dependencies.json b/json/tests/draft7/dependencies.json
index a5e5428..c0bd809 100644
--- a/json/tests/draft7/dependencies.json
+++ b/json/tests/draft7/dependencies.json
@@ -244,5 +244,43 @@
"valid": false
}
]
+ },
+ {
+ "description": "dependent subschema incompatible with root",
+ "schema": {
+ "properties": {
+ "foo": {}
+ },
+ "dependencies": {
+ "foo": {
+ "properties": {
+ "bar": {}
+ },
+ "additionalProperties": false
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "matches root",
+ "data": {"foo": 1},
+ "valid": false
+ },
+ {
+ "description": "matches dependency",
+ "data": {"bar": 1},
+ "valid": true
+ },
+ {
+ "description": "matches both",
+ "data": {"foo": 1, "bar": 2},
+ "valid": false
+ },
+ {
+ "description": "no dependency",
+ "data": {"baz": 1},
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft7/ref.json b/json/tests/draft7/ref.json
index 2bee83e..8263172 100644
--- a/json/tests/draft7/ref.json
+++ b/json/tests/draft7/ref.json
@@ -927,5 +927,90 @@
"valid": false
}
]
+ },
+ {
+ "description": "$id with file URI still resolves pointers - *nix",
+ "schema": {
+ "$id": "file:///folder/file.json",
+ "definitions": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/definitions/foo"
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "$id with file URI still resolves pointers - windows",
+ "schema": {
+ "$id": "file:///c:/folder/file.json",
+ "definitions": {
+ "foo": {
+ "type": "number"
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/definitions/foo"
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "empty tokens in $ref json-pointer",
+ "schema": {
+ "definitions": {
+ "": {
+ "definitions": {
+ "": { "type": "number" }
+ }
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/definitions//definitions/"
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "number is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "non-number is invalid",
+ "data": "a",
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft7/uniqueItems.json b/json/tests/draft7/uniqueItems.json
index 2ccf666..d2730c6 100644
--- a/json/tests/draft7/uniqueItems.json
+++ b/json/tests/draft7/uniqueItems.json
@@ -54,6 +54,11 @@
"valid": false
},
{
+ "description": "property order of array of objects is ignored",
+ "data": [{"foo": "bar", "bar": "foo"}, {"bar": "foo", "foo": "bar"}],
+ "valid": false
+ },
+ {
"description": "unique array of nested objects is valid",
"data": [
{"foo": {"bar" : {"baz" : true}}},
diff --git a/json/tox.ini b/json/tox.ini
index 7ca9de9..dcc0dce 100644
--- a/json/tox.ini
+++ b/json/tox.ini
@@ -5,5 +5,5 @@ skipsdist = True
[testenv:sanity]
# used just for validating the structure of the test case files themselves
-deps = jsonschema==4.17.3
+deps = jsonschema==4.18.0a4
commands = {envpython} bin/jsonschema_suite check