diff options
Diffstat (limited to 'json/tests/draft7')
-rw-r--r-- | json/tests/draft7/format.json | 272 | ||||
-rw-r--r-- | json/tests/draft7/optional/unicode.json | 146 |
2 files changed, 282 insertions, 136 deletions
diff --git a/json/tests/draft7/format.json b/json/tests/draft7/format.json index 93305f5..e2447d6 100644 --- a/json/tests/draft7/format.json +++ b/json/tests/draft7/format.json @@ -1,611 +1,611 @@ [ { - "description": "validation of e-mail addresses", - "schema": {"format": "email"}, + "description": "email format", + "schema": { "format": "email" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of IDN e-mail addresses", - "schema": {"format": "idn-email"}, + "description": "idn-email format", + "schema": { "format": "idn-email" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of regexes", - "schema": {"format": "regex"}, + "description": "regex format", + "schema": { "format": "regex" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of IP addresses", - "schema": {"format": "ipv4"}, + "description": "ipv4 format", + "schema": { "format": "ipv4" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of IPv6 addresses", - "schema": {"format": "ipv6"}, + "description": "ipv6 format", + "schema": { "format": "ipv6" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of IDN hostnames", - "schema": {"format": "idn-hostname"}, + "description": "idn-hostname format", + "schema": { "format": "idn-hostname" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of hostnames", - "schema": {"format": "hostname"}, + "description": "hostname format", + "schema": { "format": "hostname" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of date strings", - "schema": {"format": "date"}, + "description": "date format", + "schema": { "format": "date" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of date-time strings", - "schema": {"format": "date-time"}, + "description": "date-time format", + "schema": { "format": "date-time" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of time strings", - "schema": {"format": "time"}, + "description": "time format", + "schema": { "format": "time" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of JSON pointers", - "schema": {"format": "json-pointer"}, + "description": "json-pointer format", + "schema": { "format": "json-pointer" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of relative JSON pointers", - "schema": {"format": "relative-json-pointer"}, + "description": "relative-json-pointer format", + "schema": { "format": "relative-json-pointer" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of IRIs", - "schema": {"format": "iri"}, + "description": "iri format", + "schema": { "format": "iri" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of IRI references", - "schema": {"format": "iri-reference"}, + "description": "iri-reference format", + "schema": { "format": "iri-reference" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of URIs", - "schema": {"format": "uri"}, + "description": "uri format", + "schema": { "format": "uri" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of URI references", - "schema": {"format": "uri-reference"}, + "description": "uri-reference format", + "schema": { "format": "uri-reference" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } ] }, { - "description": "validation of URI templates", - "schema": {"format": "uri-template"}, + "description": "uri-template format", + "schema": { "format": "uri-template" }, "tests": [ { - "description": "ignores integers", + "description": "all string formats ignore integers", "data": 12, "valid": true }, { - "description": "ignores floats", + "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { - "description": "ignores objects", + "description": "all string formats ignore objects", "data": {}, "valid": true }, { - "description": "ignores arrays", + "description": "all string formats ignore arrays", "data": [], "valid": true }, { - "description": "ignores booleans", + "description": "all string formats ignore booleans", "data": false, "valid": true }, { - "description": "ignores null", + "description": "all string formats ignore nulls", "data": null, "valid": true } diff --git a/json/tests/draft7/optional/unicode.json b/json/tests/draft7/optional/unicode.json new file mode 100644 index 0000000..1dc5940 --- /dev/null +++ b/json/tests/draft7/optional/unicode.json @@ -0,0 +1,146 @@ +[ + { + "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 + } + ] + } +] |