diff options
Diffstat (limited to 'json/tests/draft7')
-rw-r--r-- | json/tests/draft7/const.json | 84 | ||||
-rw-r--r-- | json/tests/draft7/optional/format/ipv6.json | 35 | ||||
-rw-r--r-- | json/tests/draft7/optional/format/uri.json | 5 | ||||
-rw-r--r-- | json/tests/draft7/refRemote.json | 6 | ||||
-rw-r--r-- | json/tests/draft7/uniqueItems.json | 10 |
5 files changed, 137 insertions, 3 deletions
diff --git a/json/tests/draft7/const.json b/json/tests/draft7/const.json index c53d04d..1c2cafc 100644 --- a/json/tests/draft7/const.json +++ b/json/tests/draft7/const.json @@ -126,6 +126,90 @@ ] }, { + "description": "const with [false] does not match [0]", + "schema": {"const": [false]}, + "tests": [ + { + "description": "[false] is valid", + "data": [false], + "valid": true + }, + { + "description": "[0] is invalid", + "data": [0], + "valid": false + }, + { + "description": "[0.0] is invalid", + "data": [0.0], + "valid": false + } + ] + }, + { + "description": "const with [true] does not match [1]", + "schema": {"const": [true]}, + "tests": [ + { + "description": "[true] is valid", + "data": [true], + "valid": true + }, + { + "description": "[1] is invalid", + "data": [1], + "valid": false + }, + { + "description": "[1.0] is invalid", + "data": [1.0], + "valid": false + } + ] + }, + { + "description": "const with {\"a\": false} does not match {\"a\": 0}", + "schema": {"const": {"a": false}}, + "tests": [ + { + "description": "{\"a\": false} is valid", + "data": {"a": false}, + "valid": true + }, + { + "description": "{\"a\": 0} is invalid", + "data": {"a": 0}, + "valid": false + }, + { + "description": "{\"a\": 0.0} is invalid", + "data": {"a": 0.0}, + "valid": false + } + ] + }, + { + "description": "const with {\"a\": true} does not match {\"a\": 1}", + "schema": {"const": {"a": true}}, + "tests": [ + { + "description": "{\"a\": true} is valid", + "data": {"a": true}, + "valid": true + }, + { + "description": "{\"a\": 1} is invalid", + "data": {"a": 1}, + "valid": false + }, + { + "description": "{\"a\": 1.0} is invalid", + "data": {"a": 1.0}, + "valid": false + } + ] + }, + { "description": "const with 0 does not match other zero-like types", "schema": {"const": 0}, "tests": [ diff --git a/json/tests/draft7/optional/format/ipv6.json b/json/tests/draft7/optional/format/ipv6.json index 9b0881e..2a08cb4 100644 --- a/json/tests/draft7/optional/format/ipv6.json +++ b/json/tests/draft7/optional/format/ipv6.json @@ -112,6 +112,41 @@ "description": "ipv4 segment must have 4 octets", "data": "1:2:3:4:1.2.3", "valid": false + }, + { + "description": "leading whitespace is invalid", + "data": " ::1", + "valid": false + }, + { + "description": "trailing whitespace is invalid", + "data": "::1 ", + "valid": false + }, + { + "description": "netmask is not a part of ipv6 address", + "data": "fe80::/64", + "valid": false + }, + { + "description": "zone id is not a part of ipv6 address", + "data": "fe80::a%eth1", + "valid": false + }, + { + "description": "a long valid ipv6", + "data": "1000:1000:1000:1000:1000:1000:255.255.255.255", + "valid": true + }, + { + "description": "a long invalid ipv6, below length limit, first", + "data": "100:100:100:100:100:100:255.255.255.255.255", + "valid": false + }, + { + "description": "a long invalid ipv6, below length limit, second", + "data": "100:100:100:100:100:100:100:255.255.255.255", + "valid": false } ] } diff --git a/json/tests/draft7/optional/format/uri.json b/json/tests/draft7/optional/format/uri.json index 25cc40c..4306a68 100644 --- a/json/tests/draft7/optional/format/uri.json +++ b/json/tests/draft7/optional/format/uri.json @@ -97,6 +97,11 @@ "description": "an invalid URI with spaces and missing scheme", "data": ":// should fail", "valid": false + }, + { + "description": "an invalid URI with comma in scheme", + "data": "bar,baz:foo", + "valid": false } ] } diff --git a/json/tests/draft7/refRemote.json b/json/tests/draft7/refRemote.json index 819d326..74a7862 100644 --- a/json/tests/draft7/refRemote.json +++ b/json/tests/draft7/refRemote.json @@ -54,7 +54,7 @@ "schema": { "$id": "http://localhost:1234/", "items": { - "$id": "folder/", + "$id": "baseUriChange/", "items": {"$ref": "folderInteger.json"} } }, @@ -81,7 +81,7 @@ }, "definitions": { "baz": { - "$id": "folder/", + "$id": "baseUriChangeFolder/", "type": "array", "items": {"$ref": "folderInteger.json"} } @@ -110,7 +110,7 @@ }, "definitions": { "baz": { - "$id": "folder/", + "$id": "baseUriChangeFolderInSubschema/", "definitions": { "bar": { "type": "array", diff --git a/json/tests/draft7/uniqueItems.json b/json/tests/draft7/uniqueItems.json index fb1ddb5..4846c77 100644 --- a/json/tests/draft7/uniqueItems.json +++ b/json/tests/draft7/uniqueItems.json @@ -113,6 +113,16 @@ "description": "objects are non-unique despite key order", "data": [{"a": 1, "b": 2}, {"b": 2, "a": 1}], "valid": false + }, + { + "description": "{\"a\": false} and {\"a\": 0} are unique", + "data": [{"a": false}, {"a": 0}], + "valid": true + }, + { + "description": "{\"a\": true} and {\"a\": 1} are unique", + "data": [{"a": true}, {"a": 1}], + "valid": true } ] }, |