diff --git a/bin/jsonschema_suite b/bin/jsonschema_suite index b4792a05..9fee8d7b 100755 --- a/bin/jsonschema_suite +++ b/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/tests/draft-next/ref.json b/tests/draft-next/ref.json index a14b0612..1d5f2561 100644 --- a/tests/draft-next/ref.json +++ b/tests/draft-next/ref.json @@ -1026,5 +1026,34 @@ "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/tests/draft2019-09/ref.json b/tests/draft2019-09/ref.json index 0a1773f4..7d850414 100644 --- a/tests/draft2019-09/ref.json +++ b/tests/draft2019-09/ref.json @@ -1026,5 +1026,34 @@ "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/tests/draft2020-12/ref.json b/tests/draft2020-12/ref.json index 2506fe05..5f6be8c2 100644 --- a/tests/draft2020-12/ref.json +++ b/tests/draft2020-12/ref.json @@ -1026,5 +1026,34 @@ "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/tests/draft4/ref.json b/tests/draft4/ref.json index a1e86779..b53bd2ab 100644 --- a/tests/draft4/ref.json +++ b/tests/draft4/ref.json @@ -559,5 +559,34 @@ "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/tests/draft6/ref.json b/tests/draft6/ref.json index 12eaeda7..8a8908a4 100644 --- a/tests/draft6/ref.json +++ b/tests/draft6/ref.json @@ -869,5 +869,34 @@ "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/tests/draft7/ref.json b/tests/draft7/ref.json index fa0192e1..82631726 100644 --- a/tests/draft7/ref.json +++ b/tests/draft7/ref.json @@ -983,5 +983,34 @@ "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/tox.ini b/tox.ini index 7ca9de98..dcc0dce6 100644 --- a/tox.ini +++ b/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