diff options
Diffstat (limited to 'json/tests/draft2020-12/optional')
21 files changed, 849 insertions, 163 deletions
diff --git a/json/tests/draft2020-12/optional/ecmascript-regex.json b/json/tests/draft2020-12/optional/ecmascript-regex.json index fb02e99..1beb0b3 100644 --- a/json/tests/draft2020-12/optional/ecmascript-regex.json +++ b/json/tests/draft2020-12/optional/ecmascript-regex.json @@ -288,5 +288,265 @@ "valid": true } ] + }, + { + "description": "unicode semantics should be used for all pattern matching", + "schema": { "pattern": "\\p{Letter}cole" }, + "tests": [ + { + "description": "ascii character in json string", + "data": "Les hivers de mon enfance etaient des saisons longues, longues. Nous vivions en trois lieux: l'ecole, l'eglise et la patinoire; mais la vraie vie etait sur la patinoire.", + "valid": true + }, + { + "description": "literal unicode character in json string", + "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", + "valid": true + }, + { + "description": "unicode character in hex format in string", + "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.", + "valid": true + }, + { + "description": "unicode matching is case-sensitive", + "data": "LES HIVERS DE MON ENFANCE ÉTAIENT DES SAISONS LONGUES, LONGUES. NOUS VIVIONS EN TROIS LIEUX: L'ÉCOLE, L'ÉGLISE ET LA PATINOIRE; MAIS LA VRAIE VIE ÉTAIT SUR LA PATINOIRE.", + "valid": false + } + ] + }, + { + "description": "\\w in patterns matches [A-Za-z0-9_], not unicode letters", + "schema": { "pattern": "\\wcole" }, + "tests": [ + { + "description": "ascii character in json string", + "data": "Les hivers de mon enfance etaient des saisons longues, longues. Nous vivions en trois lieux: l'ecole, l'eglise et la patinoire; mais la vraie vie etait sur la patinoire.", + "valid": true + }, + { + "description": "literal unicode character in json string", + "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", + "valid": false + }, + { + "description": "unicode character in hex format in string", + "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.", + "valid": false + }, + { + "description": "unicode matching is case-sensitive", + "data": "LES HIVERS DE MON ENFANCE ÉTAIENT DES SAISONS LONGUES, LONGUES. NOUS VIVIONS EN TROIS LIEUX: L'ÉCOLE, L'ÉGLISE ET LA PATINOIRE; MAIS LA VRAIE VIE ÉTAIT SUR LA PATINOIRE.", + "valid": false + } + ] + }, + { + "description": "unicode characters do not match ascii ranges", + "schema": { "pattern": "[a-z]cole" }, + "tests": [ + { + "description": "literal unicode character in json string", + "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", + "valid": false + }, + { + "description": "unicode character in hex format in string", + "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.", + "valid": false + }, + { + "description": "ascii characters match", + "data": "Les hivers de mon enfance etaient des saisons longues, longues. Nous vivions en trois lieux: l'ecole, l'eglise et la patinoire; mais la vraie vie etait sur la patinoire.", + "valid": true + } + ] + }, + { + "description": "\\d in pattern matches [0-9], not unicode digits", + "schema": { "pattern": "^\\d+$" }, + "tests": [ + { + "description": "ascii digits", + "data": "42", + "valid": true + }, + { + "description": "ascii non-digits", + "data": "-%#", + "valid": false + }, + { + "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", + "data": "৪২", + "valid": false + } + ] + }, + { + "description": "unicode digits are more than 0 through 9", + "schema": { "pattern": "^\\p{digit}+$" }, + "tests": [ + { + "description": "ascii digits", + "data": "42", + "valid": true + }, + { + "description": "ascii non-digits", + "data": "-%#", + "valid": false + }, + { + "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", + "data": "৪২", + "valid": true + } + ] + }, + { + "description": "unicode semantics should be used for all patternProperties matching", + "schema": { + "type": "object", + "patternProperties": { + "\\p{Letter}cole": true + }, + "additionalProperties": false + }, + "tests": [ + { + "description": "ascii character in json string", + "data": { "l'ecole": "pas de vraie vie" }, + "valid": true + }, + { + "description": "literal unicode character in json string", + "data": { "l'école": "pas de vraie vie" }, + "valid": true + }, + { + "description": "unicode character in hex format in string", + "data": { "l'\u00e9cole": "pas de vraie vie" }, + "valid": true + }, + { + "description": "unicode matching is case-sensitive", + "data": { "L'ÉCOLE": "PAS DE VRAIE VIE" }, + "valid": false + } + ] + }, + { + "description": "\\w in patternProperties matches [A-Za-z0-9_], not unicode letters", + "schema": { + "type": "object", + "patternProperties": { + "\\wcole": true + }, + "additionalProperties": false + }, + "tests": [ + { + "description": "ascii character in json string", + "data": { "l'ecole": "pas de vraie vie" }, + "valid": true + }, + { + "description": "literal unicode character in json string", + "data": { "l'école": "pas de vraie vie" }, + "valid": false + }, + { + "description": "unicode character in hex format in string", + "data": { "l'\u00e9cole": "pas de vraie vie" }, + "valid": false + }, + { + "description": "unicode matching is case-sensitive", + "data": { "L'ÉCOLE": "PAS DE VRAIE VIE" }, + "valid": false + } + ] + }, + { + "description": "unicode characters do not match ascii ranges", + "schema": { + "type": "object", + "patternProperties": { + "[a-z]cole": true + }, + "additionalProperties": false + }, + "tests": [ + { + "description": "literal unicode character in json string", + "data": { "l'école": "pas de vraie vie" }, + "valid": false + }, + { + "description": "unicode character in hex format in string", + "data": { "l'\u00e9cole": "pas de vraie vie" }, + "valid": false + }, + { + "description": "ascii characters match", + "data": { "l'ecole": "pas de vraie vie" }, + "valid": true + } + ] + }, + { + "description": "\\d in patternProperties matches [0-9], not unicode digits", + "schema": { + "type": "object", + "patternProperties": { + "^\\d+$": true + }, + "additionalProperties": false + }, + "tests": [ + { + "description": "ascii digits", + "data": { "42": "life, the universe, and everything" }, + "valid": true + }, + { + "description": "ascii non-digits", + "data": { "-%#": "spending the year dead for tax reasons" }, + "valid": false + }, + { + "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", + "data": { "৪২": "khajit has wares if you have coin" }, + "valid": false + } + ] + }, + { + "description": "unicode digits are more than 0 through 9", + "schema": { + "type": "object", + "patternProperties": { + "^\\p{digit}+$": true + }, + "additionalProperties": false + }, + "tests": [ + { + "description": "ascii digits", + "data": { "42": "life, the universe, and everything" }, + "valid": true + }, + { + "description": "ascii non-digits", + "data": { "-%#": "spending the year dead for tax reasons" }, + "valid": false + }, + { + "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", + "data": { "৪২": "khajit has wares if you have coin" }, + "valid": true + } + ] } ] diff --git a/json/tests/draft2020-12/optional/format-assertion.json b/json/tests/draft2020-12/optional/format-assertion.json new file mode 100644 index 0000000..0340037 --- /dev/null +++ b/json/tests/draft2020-12/optional/format-assertion.json @@ -0,0 +1,42 @@ +[ + { + "description": "schema that uses custom metaschema with format-assertion: false", + "schema": { + "$id": "https://schema/using/format-assertion/false", + "$schema": "http://localhost:1234/draft2020-12/format-assertion-false.json", + "format": "ipv4" + }, + "tests": [ + { + "description": "format-assertion: false: valid string", + "data": "127.0.0.1", + "valid": true + }, + { + "description": "format-assertion: false: invalid string", + "data": "not-an-ipv4", + "valid": false + } + ] + }, + { + "description": "schema that uses custom metaschema with format-assertion: true", + "schema": { + "$id": "https://schema/using/format-assertion/true", + "$schema": "http://localhost:1234/draft2020-12/format-assertion-true.json", + "format": "ipv4" + }, + "tests": [ + { + "description": "format-assertion: true: valid string", + "data": "127.0.0.1", + "valid": true + }, + { + "description": "format-assertion: true: invalid string", + "data": "not-an-ipv4", + "valid": false + } + ] + } +] diff --git a/json/tests/draft2020-12/optional/format/date-time.json b/json/tests/draft2020-12/optional/format/date-time.json index 5f911ef..119179c 100644 --- a/json/tests/draft2020-12/optional/format/date-time.json +++ b/json/tests/draft2020-12/optional/format/date-time.json @@ -1,9 +1,39 @@ [ { "description": "validation of date-time strings", - "schema": {"format": "date-time"}, + "schema": { "format": "date-time" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid date-time string", "data": "1963-06-19T08:30:06.283185Z", "valid": true @@ -34,6 +64,11 @@ "valid": false }, { + "description": "an invalid closing Z after time-zone offset", + "data": "1963-06-19T08:30:06.28123+01:00Z", + "valid": false + }, + { "description": "an invalid date-time string", "data": "06/19/1963 08:30:06 PST", "valid": false diff --git a/json/tests/draft2020-12/optional/format/date.json b/json/tests/draft2020-12/optional/format/date.json index 6cc2feb..b4f61ee 100644 --- a/json/tests/draft2020-12/optional/format/date.json +++ b/json/tests/draft2020-12/optional/format/date.json @@ -1,9 +1,39 @@ [ { "description": "validation of date strings", - "schema": {"format": "date"}, + "schema": { "format": "date" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid date string", "data": "1963-06-19", "valid": true diff --git a/json/tests/draft2020-12/optional/format/duration.json b/json/tests/draft2020-12/optional/format/duration.json index eb33dbb..741348a 100644 --- a/json/tests/draft2020-12/optional/format/duration.json +++ b/json/tests/draft2020-12/optional/format/duration.json @@ -1,9 +1,39 @@ [ { "description": "validation of duration strings", - "schema": {"format": "duration"}, + "schema": { "format": "duration" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid duration string", "data": "P4DT12H30M5S", "valid": true diff --git a/json/tests/draft2020-12/optional/format/email.json b/json/tests/draft2020-12/optional/format/email.json index 02396d2..d6761a4 100644 --- a/json/tests/draft2020-12/optional/format/email.json +++ b/json/tests/draft2020-12/optional/format/email.json @@ -1,9 +1,39 @@ [ { "description": "validation of e-mail addresses", - "schema": {"format": "email"}, + "schema": { "format": "email" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid e-mail address", "data": "joe.bloggs@example.com", "valid": true diff --git a/json/tests/draft2020-12/optional/format/hostname.json b/json/tests/draft2020-12/optional/format/hostname.json index 476541a..8a67fda 100644 --- a/json/tests/draft2020-12/optional/format/hostname.json +++ b/json/tests/draft2020-12/optional/format/hostname.json @@ -1,9 +1,39 @@ [ { "description": "validation of host names", - "schema": {"format": "hostname"}, + "schema": { "format": "hostname" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid host name", "data": "www.example.com", "valid": true diff --git a/json/tests/draft2020-12/optional/format/idn-email.json b/json/tests/draft2020-12/optional/format/idn-email.json index 552d106..6e21374 100644 --- a/json/tests/draft2020-12/optional/format/idn-email.json +++ b/json/tests/draft2020-12/optional/format/idn-email.json @@ -1,9 +1,39 @@ [ { "description": "validation of an internationalized e-mail addresses", - "schema": {"format": "idn-email"}, + "schema": { "format": "idn-email" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid idn e-mail (example@example.test in Hangul)", "data": "실례@실례.테스트", "valid": true diff --git a/json/tests/draft2020-12/optional/format/idn-hostname.json b/json/tests/draft2020-12/optional/format/idn-hostname.json index bbb257b..6c8f86a 100644 --- a/json/tests/draft2020-12/optional/format/idn-hostname.json +++ b/json/tests/draft2020-12/optional/format/idn-hostname.json @@ -4,6 +4,36 @@ "schema": { "format": "idn-hostname" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid host name (example.test in Hangul)", "data": "실례.테스트", "valid": true diff --git a/json/tests/draft2020-12/optional/format/ipv4.json b/json/tests/draft2020-12/optional/format/ipv4.json index 4d10927..6b166c7 100644 --- a/json/tests/draft2020-12/optional/format/ipv4.json +++ b/json/tests/draft2020-12/optional/format/ipv4.json @@ -1,9 +1,39 @@ [ { "description": "validation of IP addresses", - "schema": {"format": "ipv4"}, + "schema": { "format": "ipv4" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid IP address", "data": "192.168.0.1", "valid": true diff --git a/json/tests/draft2020-12/optional/format/ipv6.json b/json/tests/draft2020-12/optional/format/ipv6.json index cf629c6..6379927 100644 --- a/json/tests/draft2020-12/optional/format/ipv6.json +++ b/json/tests/draft2020-12/optional/format/ipv6.json @@ -1,9 +1,39 @@ [ { "description": "validation of IPv6 addresses", - "schema": {"format": "ipv6"}, + "schema": { "format": "ipv6" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid IPv6 address", "data": "::1", "valid": true @@ -14,6 +44,16 @@ "valid": false }, { + "description": "trailing 4 hex symbols is valid", + "data": "::abef", + "valid": true + }, + { + "description": "trailing 5 hex symbols is invalid", + "data": "::abcef", + "valid": false + }, + { "description": "an IPv6 address with too many components", "data": "1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1", "valid": false @@ -54,6 +94,11 @@ "valid": false }, { + "description": "single set of double colons in the middle is valid", + "data": "1:d6::42", + "valid": true + }, + { "description": "two sets of double colons is invalid", "data": "1::d6::42", "valid": false diff --git a/json/tests/draft2020-12/optional/format/iri-reference.json b/json/tests/draft2020-12/optional/format/iri-reference.json index 1fd779c..c6b4c22 100644 --- a/json/tests/draft2020-12/optional/format/iri-reference.json +++ b/json/tests/draft2020-12/optional/format/iri-reference.json @@ -1,9 +1,39 @@ [ { "description": "validation of IRI References", - "schema": {"format": "iri-reference"}, + "schema": { "format": "iri-reference" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid IRI", "data": "http://ƒøø.ßår/?∂éœ=πîx#πîüx", "valid": true diff --git a/json/tests/draft2020-12/optional/format/iri.json b/json/tests/draft2020-12/optional/format/iri.json index 1414f2e..a0d12ae 100644 --- a/json/tests/draft2020-12/optional/format/iri.json +++ b/json/tests/draft2020-12/optional/format/iri.json @@ -1,9 +1,39 @@ [ { "description": "validation of IRIs", - "schema": {"format": "iri"}, + "schema": { "format": "iri" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid IRI with anchor tag", "data": "http://ƒøø.ßår/?∂éœ=πîx#πîüx", "valid": true diff --git a/json/tests/draft2020-12/optional/format/json-pointer.json b/json/tests/draft2020-12/optional/format/json-pointer.json index 65c2f06..a0346b5 100644 --- a/json/tests/draft2020-12/optional/format/json-pointer.json +++ b/json/tests/draft2020-12/optional/format/json-pointer.json @@ -1,9 +1,39 @@ [ { "description": "validation of JSON-pointers (JSON String Representation)", - "schema": {"format": "json-pointer"}, + "schema": { "format": "json-pointer" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid JSON-pointer", "data": "/foo/bar~0/baz~1/%a", "valid": true diff --git a/json/tests/draft2020-12/optional/format/regex.json b/json/tests/draft2020-12/optional/format/regex.json index d99d021..3449177 100644 --- a/json/tests/draft2020-12/optional/format/regex.json +++ b/json/tests/draft2020-12/optional/format/regex.json @@ -1,9 +1,39 @@ [ { "description": "validation of regular expressions", - "schema": {"format": "regex"}, + "schema": { "format": "regex" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid regular expression", "data": "([abc])+\\s+$", "valid": true diff --git a/json/tests/draft2020-12/optional/format/relative-json-pointer.json b/json/tests/draft2020-12/optional/format/relative-json-pointer.json index 22fb14e..9309986 100644 --- a/json/tests/draft2020-12/optional/format/relative-json-pointer.json +++ b/json/tests/draft2020-12/optional/format/relative-json-pointer.json @@ -1,9 +1,39 @@ [ { "description": "validation of Relative JSON Pointers (RJP)", - "schema": {"format": "relative-json-pointer"}, + "schema": { "format": "relative-json-pointer" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid upwards RJP", "data": "1", "valid": true diff --git a/json/tests/draft2020-12/optional/format/time.json b/json/tests/draft2020-12/optional/format/time.json index 0a8da0e..5011d78 100644 --- a/json/tests/draft2020-12/optional/format/time.json +++ b/json/tests/draft2020-12/optional/format/time.json @@ -1,9 +1,39 @@ [ { "description": "validation of time strings", - "schema": {"format": "time"}, + "schema": { "format": "time" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid time string", "data": "08:30:06Z", "valid": true diff --git a/json/tests/draft2020-12/optional/format/uri-reference.json b/json/tests/draft2020-12/optional/format/uri-reference.json index e4c9eef..7cdf228 100644 --- a/json/tests/draft2020-12/optional/format/uri-reference.json +++ b/json/tests/draft2020-12/optional/format/uri-reference.json @@ -1,9 +1,39 @@ [ { "description": "validation of URI References", - "schema": {"format": "uri-reference"}, + "schema": { "format": "uri-reference" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid URI", "data": "http://foo.bar/?baz=qux#quux", "valid": true diff --git a/json/tests/draft2020-12/optional/format/uri-template.json b/json/tests/draft2020-12/optional/format/uri-template.json index 33ab76e..df355c5 100644 --- a/json/tests/draft2020-12/optional/format/uri-template.json +++ b/json/tests/draft2020-12/optional/format/uri-template.json @@ -1,9 +1,39 @@ [ { "description": "format: uri-template", - "schema": {"format": "uri-template"}, + "schema": { "format": "uri-template" }, "tests": [ { + "description": "all string formats ignore integers", + "data": 12, + "valid": true + }, + { + "description": "all string formats ignore floats", + "data": 13.7, + "valid": true + }, + { + "description": "all string formats ignore objects", + "data": {}, + "valid": true + }, + { + "description": "all string formats ignore arrays", + "data": [], + "valid": true + }, + { + "description": "all string formats ignore booleans", + "data": false, + "valid": true + }, + { + "description": "all string formats ignore nulls", + "data": null, + "valid": true + }, + { "description": "a valid uri-template", "data": "http://example.com/dictionary/{term:1}/{term}", "valid": true diff --git a/json/tests/draft2020-12/optional/format/uri.json b/json/tests/draft2020-12/optional/format/uri.json index 58d3085..792d71a 100644 --- a/json/tests/draft2020-12/optional/format/uri.json +++ b/json/tests/draft2020-12/optional/format/uri.json @@ -1,7 +1,7 @@ [ { "description": "validation of URIs", - "schema": {"format": "uri"}, + "schema": { "format": "uri" }, "tests": [ { "description": "a valid URL with anchor tag", diff --git a/json/tests/draft2020-12/optional/unicode.json b/json/tests/draft2020-12/optional/unicode.json deleted file mode 100644 index 1dc5940..0000000 --- a/json/tests/draft2020-12/optional/unicode.json +++ /dev/null @@ -1,146 +0,0 @@ -[ - { - "description": "unicode semantics should be used for all pattern matching", - "schema": { "pattern": "\\wcole" }, - "tests": [ - { - "description": "literal unicode character in json string", - "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", - "valid": true - }, - { - "description": "unicode character in hex format in string", - "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.", - "valid": true - }, - { - "description": "unicode matching is case-sensitive", - "data": "LES HIVERS DE MON ENFANCE ÉTAIENT DES SAISONS LONGUES, LONGUES. NOUS VIVIONS EN TROIS LIEUX: L'ÉCOLE, L'ÉGLISE ET LA PATINOIRE; MAIS LA VRAIE VIE ÉTAIT SUR LA PATINOIRE.", - "valid": false - } - ] - }, - { - "description": "unicode characters do not match ascii ranges", - "schema": { "pattern": "[a-z]cole" }, - "tests": [ - { - "description": "literal unicode character in json string", - "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", - "valid": false - }, - { - "description": "unicode character in hex format in string", - "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.", - "valid": false - }, - { - "description": "ascii characters match", - "data": "Les hivers de mon enfance etaient des saisons longues, longues. Nous vivions en trois lieux: l'ecole, l'eglise et la patinoire; mais la vraie vie etait sur la patinoire.", - "valid": true - } - ] - }, - { - "description": "unicode digits are more than 0 through 9", - "schema": { "pattern": "^\\d+$" }, - "tests": [ - { - "description": "ascii digits", - "data": "42", - "valid": true - }, - { - "description": "ascii non-digits", - "data": "-%#", - "valid": false - }, - { - "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", - "data": "৪২", - "valid": true - } - ] - }, - { - "description": "unicode semantics should be used for all patternProperties matching", - "schema": { - "type": "object", - "patternProperties": { - "\\wcole": true - }, - "additionalProperties": false - }, - "tests": [ - { - "description": "literal unicode character in json string", - "data": { "l'école": "pas de vraie vie" }, - "valid": true - }, - { - "description": "unicode character in hex format in string", - "data": { "l'\u00e9cole": "pas de vraie vie" }, - "valid": true - }, - { - "description": "unicode matching is case-sensitive", - "data": { "L'ÉCOLE": "PAS DE VRAIE VIE" }, - "valid": false - } - ] - }, - { - "description": "unicode characters do not match ascii ranges", - "schema": { - "type": "object", - "patternProperties": { - "[a-z]cole": true - }, - "additionalProperties": false - }, - "tests": [ - { - "description": "literal unicode character in json string", - "data": { "l'école": "pas de vraie vie" }, - "valid": false - }, - { - "description": "unicode character in hex format in string", - "data": { "l'\u00e9cole": "pas de vraie vie" }, - "valid": false - }, - { - "description": "ascii characters match", - "data": { "l'ecole": "pas de vraie vie" }, - "valid": true - } - ] - }, - { - "description": "unicode digits are more than 0 through 9", - "schema": { - "type": "object", - "patternProperties": { - "^\\d+$": true - }, - "additionalProperties": false - }, - "tests": [ - { - "description": "ascii digits", - "data": { "42": "life, the universe, and everything" }, - "valid": true - }, - { - "description": "ascii non-digits", - "data": { "-%#": "spending the year dead for tax reasons" }, - "valid": false - }, - { - "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", - "data": { "৪২": "khajit has wares if you have coin" }, - "valid": true - } - ] - } -] |