summaryrefslogtreecommitdiff
path: root/json/tests/draft-next/optional
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2021-10-19 18:34:35 -0400
committerJulian Berman <Julian@GrayVines.com>2021-10-19 18:34:35 -0400
commitd837e9749328e7173b78ff19b5e2f539579ff866 (patch)
tree9361326496040eff8599791b518c6634eea52fe0 /json/tests/draft-next/optional
parent53864d28f3dcbc0556661054752111ca5e4ecd57 (diff)
parent4ecbea58e0828696f7714abba624e2160518fddd (diff)
downloadjsonschema-d837e9749328e7173b78ff19b5e2f539579ff866.tar.gz
Merge commit '4ecbea58e0828696f7714abba624e2160518fddd'
* commit '4ecbea58e0828696f7714abba624e2160518fddd': Squashed 'json/' changes from 54440eab4..ba3a90534
Diffstat (limited to 'json/tests/draft-next/optional')
-rw-r--r--json/tests/draft-next/optional/bignum.json93
-rw-r--r--json/tests/draft-next/optional/ecmascript-regex.json552
-rw-r--r--json/tests/draft-next/optional/float-overflow.json13
-rw-r--r--json/tests/draft-next/optional/format-assertion.json42
-rw-r--r--json/tests/draft-next/optional/format/date-time.json133
-rw-r--r--json/tests/draft-next/optional/format/date.json223
-rw-r--r--json/tests/draft-next/optional/format/duration.json128
-rw-r--r--json/tests/draft-next/optional/format/email.json83
-rw-r--r--json/tests/draft-next/optional/format/hostname.json98
-rw-r--r--json/tests/draft-next/optional/format/idn-email.json58
-rw-r--r--json/tests/draft-next/optional/format/idn-hostname.json304
-rw-r--r--json/tests/draft-next/optional/format/ipv4.json84
-rw-r--r--json/tests/draft-next/optional/format/ipv6.json208
-rw-r--r--json/tests/draft-next/optional/format/iri-reference.json73
-rw-r--r--json/tests/draft-next/optional/format/iri.json83
-rw-r--r--json/tests/draft-next/optional/format/json-pointer.json198
-rw-r--r--json/tests/draft-next/optional/format/regex.json48
-rw-r--r--json/tests/draft-next/optional/format/relative-json-pointer.json83
-rw-r--r--json/tests/draft-next/optional/format/time.json198
-rw-r--r--json/tests/draft-next/optional/format/uri-reference.json73
-rw-r--r--json/tests/draft-next/optional/format/uri-template.json58
-rw-r--r--json/tests/draft-next/optional/format/uri.json108
-rw-r--r--json/tests/draft-next/optional/format/uuid.json85
-rw-r--r--json/tests/draft-next/optional/non-bmp-regex.json82
-rw-r--r--json/tests/draft-next/optional/refOfUnknownKeyword.json44
25 files changed, 3152 insertions, 0 deletions
diff --git a/json/tests/draft-next/optional/bignum.json b/json/tests/draft-next/optional/bignum.json
new file mode 100644
index 0000000..3f49226
--- /dev/null
+++ b/json/tests/draft-next/optional/bignum.json
@@ -0,0 +1,93 @@
+[
+ {
+ "description": "integer",
+ "schema": { "type": "integer" },
+ "tests": [
+ {
+ "description": "a bignum is an integer",
+ "data": 12345678910111213141516171819202122232425262728293031,
+ "valid": true
+ },
+ {
+ "description": "a negative bignum is an integer",
+ "data": -12345678910111213141516171819202122232425262728293031,
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "number",
+ "schema": { "type": "number" },
+ "tests": [
+ {
+ "description": "a bignum is a number",
+ "data": 98249283749234923498293171823948729348710298301928331,
+ "valid": true
+ },
+ {
+ "description": "a negative bignum is a number",
+ "data": -98249283749234923498293171823948729348710298301928331,
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "string",
+ "schema": { "type": "string" },
+ "tests": [
+ {
+ "description": "a bignum is not a string",
+ "data": 98249283749234923498293171823948729348710298301928331,
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "integer comparison",
+ "schema": { "maximum": 18446744073709551615 },
+ "tests": [
+ {
+ "description": "comparison works for high numbers",
+ "data": 18446744073709551600,
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "float comparison with high precision",
+ "schema": {
+ "exclusiveMaximum": 972783798187987123879878123.18878137
+ },
+ "tests": [
+ {
+ "description": "comparison works for high numbers",
+ "data": 972783798187987123879878123.188781371,
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "integer comparison",
+ "schema": { "minimum": -18446744073709551615 },
+ "tests": [
+ {
+ "description": "comparison works for very negative numbers",
+ "data": -18446744073709551600,
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "float comparison with high precision on negative numbers",
+ "schema": {
+ "exclusiveMinimum": -972783798187987123879878123.18878137
+ },
+ "tests": [
+ {
+ "description": "comparison works for very negative numbers",
+ "data": -972783798187987123879878123.188781371,
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/ecmascript-regex.json b/json/tests/draft-next/optional/ecmascript-regex.json
new file mode 100644
index 0000000..1beb0b3
--- /dev/null
+++ b/json/tests/draft-next/optional/ecmascript-regex.json
@@ -0,0 +1,552 @@
+[
+ {
+ "description": "ECMA 262 regex $ does not match trailing newline",
+ "schema": {
+ "type": "string",
+ "pattern": "^abc$"
+ },
+ "tests": [
+ {
+ "description": "matches in Python, but should not in jsonschema",
+ "data": "abc\\n",
+ "valid": false
+ },
+ {
+ "description": "should match",
+ "data": "abc",
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "ECMA 262 regex converts \\t to horizontal tab",
+ "schema": {
+ "type": "string",
+ "pattern": "^\\t$"
+ },
+ "tests": [
+ {
+ "description": "does not match",
+ "data": "\\t",
+ "valid": false
+ },
+ {
+ "description": "matches",
+ "data": "\u0009",
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "ECMA 262 regex escapes control codes with \\c and upper letter",
+ "schema": {
+ "type": "string",
+ "pattern": "^\\cC$"
+ },
+ "tests": [
+ {
+ "description": "does not match",
+ "data": "\\cC",
+ "valid": false
+ },
+ {
+ "description": "matches",
+ "data": "\u0003",
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "ECMA 262 regex escapes control codes with \\c and lower letter",
+ "schema": {
+ "type": "string",
+ "pattern": "^\\cc$"
+ },
+ "tests": [
+ {
+ "description": "does not match",
+ "data": "\\cc",
+ "valid": false
+ },
+ {
+ "description": "matches",
+ "data": "\u0003",
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "ECMA 262 \\d matches ascii digits only",
+ "schema": {
+ "type": "string",
+ "pattern": "^\\d$"
+ },
+ "tests": [
+ {
+ "description": "ASCII zero matches",
+ "data": "0",
+ "valid": true
+ },
+ {
+ "description": "NKO DIGIT ZERO does not match (unlike e.g. Python)",
+ "data": "߀",
+ "valid": false
+ },
+ {
+ "description": "NKO DIGIT ZERO (as \\u escape) does not match",
+ "data": "\u07c0",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "ECMA 262 \\D matches everything but ascii digits",
+ "schema": {
+ "type": "string",
+ "pattern": "^\\D$"
+ },
+ "tests": [
+ {
+ "description": "ASCII zero does not match",
+ "data": "0",
+ "valid": false
+ },
+ {
+ "description": "NKO DIGIT ZERO matches (unlike e.g. Python)",
+ "data": "߀",
+ "valid": true
+ },
+ {
+ "description": "NKO DIGIT ZERO (as \\u escape) matches",
+ "data": "\u07c0",
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "ECMA 262 \\w matches ascii letters only",
+ "schema": {
+ "type": "string",
+ "pattern": "^\\w$"
+ },
+ "tests": [
+ {
+ "description": "ASCII 'a' matches",
+ "data": "a",
+ "valid": true
+ },
+ {
+ "description": "latin-1 e-acute does not match (unlike e.g. Python)",
+ "data": "é",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "ECMA 262 \\W matches everything but ascii letters",
+ "schema": {
+ "type": "string",
+ "pattern": "^\\W$"
+ },
+ "tests": [
+ {
+ "description": "ASCII 'a' does not match",
+ "data": "a",
+ "valid": false
+ },
+ {
+ "description": "latin-1 e-acute matches (unlike e.g. Python)",
+ "data": "é",
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "ECMA 262 \\s matches whitespace",
+ "schema": {
+ "type": "string",
+ "pattern": "^\\s$"
+ },
+ "tests": [
+ {
+ "description": "ASCII space matches",
+ "data": " ",
+ "valid": true
+ },
+ {
+ "description": "Character tabulation matches",
+ "data": "\t",
+ "valid": true
+ },
+ {
+ "description": "Line tabulation matches",
+ "data": "\u000b",
+ "valid": true
+ },
+ {
+ "description": "Form feed matches",
+ "data": "\u000c",
+ "valid": true
+ },
+ {
+ "description": "latin-1 non-breaking-space matches",
+ "data": "\u00a0",
+ "valid": true
+ },
+ {
+ "description": "zero-width whitespace matches",
+ "data": "\ufeff",
+ "valid": true
+ },
+ {
+ "description": "line feed matches (line terminator)",
+ "data": "\u000a",
+ "valid": true
+ },
+ {
+ "description": "paragraph separator matches (line terminator)",
+ "data": "\u2029",
+ "valid": true
+ },
+ {
+ "description": "EM SPACE matches (Space_Separator)",
+ "data": "\u2003",
+ "valid": true
+ },
+ {
+ "description": "Non-whitespace control does not match",
+ "data": "\u0001",
+ "valid": false
+ },
+ {
+ "description": "Non-whitespace does not match",
+ "data": "\u2013",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "ECMA 262 \\S matches everything but whitespace",
+ "schema": {
+ "type": "string",
+ "pattern": "^\\S$"
+ },
+ "tests": [
+ {
+ "description": "ASCII space does not match",
+ "data": " ",
+ "valid": false
+ },
+ {
+ "description": "Character tabulation does not match",
+ "data": "\t",
+ "valid": false
+ },
+ {
+ "description": "Line tabulation does not match",
+ "data": "\u000b",
+ "valid": false
+ },
+ {
+ "description": "Form feed does not match",
+ "data": "\u000c",
+ "valid": false
+ },
+ {
+ "description": "latin-1 non-breaking-space does not match",
+ "data": "\u00a0",
+ "valid": false
+ },
+ {
+ "description": "zero-width whitespace does not match",
+ "data": "\ufeff",
+ "valid": false
+ },
+ {
+ "description": "line feed does not match (line terminator)",
+ "data": "\u000a",
+ "valid": false
+ },
+ {
+ "description": "paragraph separator does not match (line terminator)",
+ "data": "\u2029",
+ "valid": false
+ },
+ {
+ "description": "EM SPACE does not match (Space_Separator)",
+ "data": "\u2003",
+ "valid": false
+ },
+ {
+ "description": "Non-whitespace control matches",
+ "data": "\u0001",
+ "valid": true
+ },
+ {
+ "description": "Non-whitespace matches",
+ "data": "\u2013",
+ "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/draft-next/optional/float-overflow.json b/json/tests/draft-next/optional/float-overflow.json
new file mode 100644
index 0000000..52ff982
--- /dev/null
+++ b/json/tests/draft-next/optional/float-overflow.json
@@ -0,0 +1,13 @@
+[
+ {
+ "description": "all integers are multiples of 0.5, if overflow is handled",
+ "schema": {"type": "integer", "multipleOf": 0.5},
+ "tests": [
+ {
+ "description": "valid if optional overflow handling is implemented",
+ "data": 1e308,
+ "valid": true
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format-assertion.json b/json/tests/draft-next/optional/format-assertion.json
new file mode 100644
index 0000000..0340037
--- /dev/null
+++ b/json/tests/draft-next/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/draft-next/optional/format/date-time.json b/json/tests/draft-next/optional/format/date-time.json
new file mode 100644
index 0000000..f4f9933
--- /dev/null
+++ b/json/tests/draft-next/optional/format/date-time.json
@@ -0,0 +1,133 @@
+[
+ {
+ "description": "validation of date-time strings",
+ "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
+ },
+ {
+ "description": "a valid date-time string without second fraction",
+ "data": "1963-06-19T08:30:06Z",
+ "valid": true
+ },
+ {
+ "description": "a valid date-time string with plus offset",
+ "data": "1937-01-01T12:00:27.87+00:20",
+ "valid": true
+ },
+ {
+ "description": "a valid date-time string with minus offset",
+ "data": "1990-12-31T15:59:50.123-08:00",
+ "valid": true
+ },
+ {
+ "description": "a valid date-time with a leap second, UTC",
+ "data": "1998-12-31T23:59:60Z",
+ "valid": true
+ },
+ {
+ "description": "a valid date-time with a leap second, with minus offset",
+ "data": "1998-12-31T15:59:60.123-08:00",
+ "valid": true
+ },
+ {
+ "description": "an invalid date-time past leap second, UTC",
+ "data": "1998-12-31T23:59:61Z",
+ "valid": false
+ },
+ {
+ "description": "an invalid date-time with leap second on a wrong minute, UTC",
+ "data": "1998-12-31T23:58:60Z",
+ "valid": false
+ },
+ {
+ "description": "an invalid date-time with leap second on a wrong hour, UTC",
+ "data": "1998-12-31T22:59:60Z",
+ "valid": false
+ },
+ {
+ "description": "an invalid day in date-time string",
+ "data": "1990-02-31T15:59:59.123-08:00",
+ "valid": false
+ },
+ {
+ "description": "an invalid offset in date-time string",
+ "data": "1990-12-31T15:59:59-24:00",
+ "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
+ },
+ {
+ "description": "case-insensitive T and Z",
+ "data": "1963-06-19t08:30:06.283185z",
+ "valid": true
+ },
+ {
+ "description": "only RFC3339 not all of ISO 8601 are valid",
+ "data": "2013-350T01:01:01",
+ "valid": false
+ },
+ {
+ "description": "invalid non-padded month dates",
+ "data": "1963-6-19T08:30:06.283185Z",
+ "valid": false
+ },
+ {
+ "description": "invalid non-padded day dates",
+ "data": "1963-06-1T08:30:06.283185Z",
+ "valid": false
+ },
+ {
+ "description": "non-ascii digits should be rejected in the date portion",
+ "data": "1963-06-1৪T00:00:00Z",
+ "valid": false
+ },
+ {
+ "description": "non-ascii digits should be rejected in the time portion",
+ "data": "1963-06-11T0৪:00:00Z",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/date.json b/json/tests/draft-next/optional/format/date.json
new file mode 100644
index 0000000..b4f61ee
--- /dev/null
+++ b/json/tests/draft-next/optional/format/date.json
@@ -0,0 +1,223 @@
+[
+ {
+ "description": "validation of date strings",
+ "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
+ },
+ {
+ "description": "a valid date string with 31 days in January",
+ "data": "2020-01-31",
+ "valid": true
+ },
+ {
+ "description": "a invalid date string with 32 days in January",
+ "data": "2020-01-32",
+ "valid": false
+ },
+ {
+ "description": "a valid date string with 28 days in February (normal)",
+ "data": "2021-02-28",
+ "valid": true
+ },
+ {
+ "description": "a invalid date string with 29 days in February (normal)",
+ "data": "2021-02-29",
+ "valid": false
+ },
+ {
+ "description": "a valid date string with 29 days in February (leap)",
+ "data": "2020-02-29",
+ "valid": true
+ },
+ {
+ "description": "a invalid date string with 30 days in February (leap)",
+ "data": "2020-02-30",
+ "valid": false
+ },
+ {
+ "description": "a valid date string with 31 days in March",
+ "data": "2020-03-31",
+ "valid": true
+ },
+ {
+ "description": "a invalid date string with 32 days in March",
+ "data": "2020-03-32",
+ "valid": false
+ },
+ {
+ "description": "a valid date string with 30 days in April",
+ "data": "2020-04-30",
+ "valid": true
+ },
+ {
+ "description": "a invalid date string with 31 days in April",
+ "data": "2020-04-31",
+ "valid": false
+ },
+ {
+ "description": "a valid date string with 31 days in May",
+ "data": "2020-05-31",
+ "valid": true
+ },
+ {
+ "description": "a invalid date string with 32 days in May",
+ "data": "2020-05-32",
+ "valid": false
+ },
+ {
+ "description": "a valid date string with 30 days in June",
+ "data": "2020-06-30",
+ "valid": true
+ },
+ {
+ "description": "a invalid date string with 31 days in June",
+ "data": "2020-06-31",
+ "valid": false
+ },
+ {
+ "description": "a valid date string with 31 days in July",
+ "data": "2020-07-31",
+ "valid": true
+ },
+ {
+ "description": "a invalid date string with 32 days in July",
+ "data": "2020-07-32",
+ "valid": false
+ },
+ {
+ "description": "a valid date string with 31 days in August",
+ "data": "2020-08-31",
+ "valid": true
+ },
+ {
+ "description": "a invalid date string with 32 days in August",
+ "data": "2020-08-32",
+ "valid": false
+ },
+ {
+ "description": "a valid date string with 30 days in September",
+ "data": "2020-09-30",
+ "valid": true
+ },
+ {
+ "description": "a invalid date string with 31 days in September",
+ "data": "2020-09-31",
+ "valid": false
+ },
+ {
+ "description": "a valid date string with 31 days in October",
+ "data": "2020-10-31",
+ "valid": true
+ },
+ {
+ "description": "a invalid date string with 32 days in October",
+ "data": "2020-10-32",
+ "valid": false
+ },
+ {
+ "description": "a valid date string with 30 days in November",
+ "data": "2020-11-30",
+ "valid": true
+ },
+ {
+ "description": "a invalid date string with 31 days in November",
+ "data": "2020-11-31",
+ "valid": false
+ },
+ {
+ "description": "a valid date string with 31 days in December",
+ "data": "2020-12-31",
+ "valid": true
+ },
+ {
+ "description": "a invalid date string with 32 days in December",
+ "data": "2020-12-32",
+ "valid": false
+ },
+ {
+ "description": "a invalid date string with invalid month",
+ "data": "2020-13-01",
+ "valid": false
+ },
+ {
+ "description": "an invalid date string",
+ "data": "06/19/1963",
+ "valid": false
+ },
+ {
+ "description": "only RFC3339 not all of ISO 8601 are valid",
+ "data": "2013-350",
+ "valid": false
+ },
+ {
+ "description": "non-padded month dates are not valid",
+ "data": "1998-1-20",
+ "valid": false
+ },
+ {
+ "description": "non-padded day dates are not valid",
+ "data": "1998-01-1",
+ "valid": false
+ },
+ {
+ "description": "invalid month",
+ "data": "1998-13-01",
+ "valid": false
+ },
+ {
+ "description": "invalid month-day combination",
+ "data": "1998-04-31",
+ "valid": false
+ },
+ {
+ "description": "2021 is not a leap year",
+ "data": "2021-02-29",
+ "valid": false
+ },
+ {
+ "description": "2020 is a leap year",
+ "data": "2020-02-29",
+ "valid": true
+ },
+ {
+ "description": "non-ascii digits should be rejected",
+ "data": "1963-06-1৪",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/duration.json b/json/tests/draft-next/optional/format/duration.json
new file mode 100644
index 0000000..741348a
--- /dev/null
+++ b/json/tests/draft-next/optional/format/duration.json
@@ -0,0 +1,128 @@
+[
+ {
+ "description": "validation of duration strings",
+ "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
+ },
+ {
+ "description": "an invalid duration string",
+ "data": "PT1D",
+ "valid": false
+ },
+ {
+ "description": "no elements present",
+ "data": "P",
+ "valid": false
+ },
+ {
+ "description": "no time elements present",
+ "data": "P1YT",
+ "valid": false
+ },
+ {
+ "description": "no date or time elements present",
+ "data": "PT",
+ "valid": false
+ },
+ {
+ "description": "elements out of order",
+ "data": "P2D1Y",
+ "valid": false
+ },
+ {
+ "description": "missing time separator",
+ "data": "P1D2H",
+ "valid": false
+ },
+ {
+ "description": "time element in the date position",
+ "data": "P2S",
+ "valid": false
+ },
+ {
+ "description": "four years duration",
+ "data": "P4Y",
+ "valid": true
+ },
+ {
+ "description": "zero time, in seconds",
+ "data": "PT0S",
+ "valid": true
+ },
+ {
+ "description": "zero time, in days",
+ "data": "P0D",
+ "valid": true
+ },
+ {
+ "description": "one month duration",
+ "data": "P1M",
+ "valid": true
+ },
+ {
+ "description": "one minute duration",
+ "data": "PT1M",
+ "valid": true
+ },
+ {
+ "description": "one and a half days, in hours",
+ "data": "PT36H",
+ "valid": true
+ },
+ {
+ "description": "one and a half days, in days and hours",
+ "data": "P1DT12H",
+ "valid": true
+ },
+ {
+ "description": "two weeks",
+ "data": "P2W",
+ "valid": true
+ },
+ {
+ "description": "weeks cannot be combined with other units",
+ "data": "P1Y2W",
+ "valid": false
+ },
+ {
+ "description": "non-ascii digits should be rejected",
+ "data": "P২Y",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/email.json b/json/tests/draft-next/optional/format/email.json
new file mode 100644
index 0000000..d6761a4
--- /dev/null
+++ b/json/tests/draft-next/optional/format/email.json
@@ -0,0 +1,83 @@
+[
+ {
+ "description": "validation of e-mail addresses",
+ "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
+ },
+ {
+ "description": "an invalid e-mail address",
+ "data": "2962",
+ "valid": false
+ },
+ {
+ "description": "tilde in local part is valid",
+ "data": "te~st@example.com",
+ "valid": true
+ },
+ {
+ "description": "tilde before local part is valid",
+ "data": "~test@example.com",
+ "valid": true
+ },
+ {
+ "description": "tilde after local part is valid",
+ "data": "test~@example.com",
+ "valid": true
+ },
+ {
+ "description": "dot before local part is not valid",
+ "data": ".test@example.com",
+ "valid": false
+ },
+ {
+ "description": "dot after local part is not valid",
+ "data": "test.@example.com",
+ "valid": false
+ },
+ {
+ "description": "two separated dots inside local part are valid",
+ "data": "te.s.t@example.com",
+ "valid": true
+ },
+ {
+ "description": "two subsequent dots inside local part are not valid",
+ "data": "te..st@example.com",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/hostname.json b/json/tests/draft-next/optional/format/hostname.json
new file mode 100644
index 0000000..8a67fda
--- /dev/null
+++ b/json/tests/draft-next/optional/format/hostname.json
@@ -0,0 +1,98 @@
+[
+ {
+ "description": "validation of host names",
+ "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
+ },
+ {
+ "description": "a valid punycoded IDN hostname",
+ "data": "xn--4gbwdl.xn--wgbh1c",
+ "valid": true
+ },
+ {
+ "description": "a host name starting with an illegal character",
+ "data": "-a-host-name-that-starts-with--",
+ "valid": false
+ },
+ {
+ "description": "a host name containing illegal characters",
+ "data": "not_a_valid_host_name",
+ "valid": false
+ },
+ {
+ "description": "a host name with a component too long",
+ "data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
+ "valid": false
+ },
+ {
+ "description": "starts with hyphen",
+ "data": "-hostname",
+ "valid": false
+ },
+ {
+ "description": "ends with hyphen",
+ "data": "hostname-",
+ "valid": false
+ },
+ {
+ "description": "starts with underscore",
+ "data": "_hostname",
+ "valid": false
+ },
+ {
+ "description": "ends with underscore",
+ "data": "hostname_",
+ "valid": false
+ },
+ {
+ "description": "contains underscore",
+ "data": "host_name",
+ "valid": false
+ },
+ {
+ "description": "maximum label length",
+ "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
+ "valid": true
+ },
+ {
+ "description": "exceeds maximum label length",
+ "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/idn-email.json b/json/tests/draft-next/optional/format/idn-email.json
new file mode 100644
index 0000000..6e21374
--- /dev/null
+++ b/json/tests/draft-next/optional/format/idn-email.json
@@ -0,0 +1,58 @@
+[
+ {
+ "description": "validation of an internationalized e-mail addresses",
+ "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
+ },
+ {
+ "description": "an invalid idn e-mail address",
+ "data": "2962",
+ "valid": false
+ },
+ {
+ "description": "a valid e-mail address",
+ "data": "joe.bloggs@example.com",
+ "valid": true
+ },
+ {
+ "description": "an invalid e-mail address",
+ "data": "2962",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/idn-hostname.json b/json/tests/draft-next/optional/format/idn-hostname.json
new file mode 100644
index 0000000..6c8f86a
--- /dev/null
+++ b/json/tests/draft-next/optional/format/idn-hostname.json
@@ -0,0 +1,304 @@
+[
+ {
+ "description": "validation of internationalized host names",
+ "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
+ },
+ {
+ "description": "illegal first char U+302E Hangul single dot tone mark",
+ "data": "〮실례.테스트",
+ "valid": false
+ },
+ {
+ "description": "contains illegal char U+302E Hangul single dot tone mark",
+ "data": "실〮례.테스트",
+ "valid": false
+ },
+ {
+ "description": "a host name with a component too long",
+ "data": "실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실실례례테스트례례례례례례례례례례례례례례례례례테스트례례례례례례례례례례례례례례례례례례례테스트례례례례례례례례례례례례테스트례례실례.테스트",
+ "valid": false
+ },
+ {
+ "description": "invalid label, correct Punycode",
+ "comment": "https://tools.ietf.org/html/rfc5890#section-2.3.2.1 https://tools.ietf.org/html/rfc5891#section-4.4 https://tools.ietf.org/html/rfc3492#section-7.1",
+ "data": "-> $1.00 <--",
+ "valid": false
+ },
+ {
+ "description": "valid Chinese Punycode",
+ "comment": "https://tools.ietf.org/html/rfc5890#section-2.3.2.1 https://tools.ietf.org/html/rfc5891#section-4.4",
+ "data": "xn--ihqwcrb4cv8a8dqg056pqjye",
+ "valid": true
+ },
+ {
+ "description": "invalid Punycode",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.4 https://tools.ietf.org/html/rfc5890#section-2.3.2.1",
+ "data": "xn--X",
+ "valid": false
+ },
+ {
+ "description": "U-label contains \"--\" in the 3rd and 4th position",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.1 https://tools.ietf.org/html/rfc5890#section-2.3.2.1",
+ "data": "XN--aa---o47jg78q",
+ "valid": false
+ },
+ {
+ "description": "U-label starts with a dash",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.1",
+ "data": "-hello",
+ "valid": false
+ },
+ {
+ "description": "U-label ends with a dash",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.1",
+ "data": "hello-",
+ "valid": false
+ },
+ {
+ "description": "U-label starts and ends with a dash",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.1",
+ "data": "-hello-",
+ "valid": false
+ },
+ {
+ "description": "Begins with a Spacing Combining Mark",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.2",
+ "data": "\u0903hello",
+ "valid": false
+ },
+ {
+ "description": "Begins with a Nonspacing Mark",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.2",
+ "data": "\u0300hello",
+ "valid": false
+ },
+ {
+ "description": "Begins with an Enclosing Mark",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.2",
+ "data": "\u0488hello",
+ "valid": false
+ },
+ {
+ "description": "Exceptions that are PVALID, left-to-right chars",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6",
+ "data": "\u00df\u03c2\u0f0b\u3007",
+ "valid": true
+ },
+ {
+ "description": "Exceptions that are PVALID, right-to-left chars",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6",
+ "data": "\u06fd\u06fe",
+ "valid": true
+ },
+ {
+ "description": "Exceptions that are DISALLOWED, right-to-left chars",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6",
+ "data": "\u0640\u07fa",
+ "valid": false
+ },
+ {
+ "description": "Exceptions that are DISALLOWED, left-to-right chars",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6 Note: The two combining marks (U+302E and U+302F) are in the middle and not at the start",
+ "data": "\u3031\u3032\u3033\u3034\u3035\u302e\u302f\u303b",
+ "valid": false
+ },
+ {
+ "description": "MIDDLE DOT with no preceding 'l'",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
+ "data": "a\u00b7l",
+ "valid": false
+ },
+ {
+ "description": "MIDDLE DOT with nothing preceding",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
+ "data": "\u00b7l",
+ "valid": false
+ },
+ {
+ "description": "MIDDLE DOT with no following 'l'",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
+ "data": "l\u00b7a",
+ "valid": false
+ },
+ {
+ "description": "MIDDLE DOT with nothing following",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
+ "data": "l\u00b7",
+ "valid": false
+ },
+ {
+ "description": "MIDDLE DOT with surrounding 'l's",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
+ "data": "l\u00b7l",
+ "valid": true
+ },
+ {
+ "description": "Greek KERAIA not followed by Greek",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4",
+ "data": "\u03b1\u0375S",
+ "valid": false
+ },
+ {
+ "description": "Greek KERAIA not followed by anything",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4",
+ "data": "\u03b1\u0375",
+ "valid": false
+ },
+ {
+ "description": "Greek KERAIA followed by Greek",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4",
+ "data": "\u03b1\u0375\u03b2",
+ "valid": true
+ },
+ {
+ "description": "Hebrew GERESH not preceded by Hebrew",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5",
+ "data": "A\u05f3\u05d1",
+ "valid": false
+ },
+ {
+ "description": "Hebrew GERESH not preceded by anything",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5",
+ "data": "\u05f3\u05d1",
+ "valid": false
+ },
+ {
+ "description": "Hebrew GERESH preceded by Hebrew",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5",
+ "data": "\u05d0\u05f3\u05d1",
+ "valid": true
+ },
+ {
+ "description": "Hebrew GERSHAYIM not preceded by Hebrew",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.6",
+ "data": "A\u05f4\u05d1",
+ "valid": false
+ },
+ {
+ "description": "Hebrew GERSHAYIM not preceded by anything",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.6",
+ "data": "\u05f4\u05d1",
+ "valid": false
+ },
+ {
+ "description": "Hebrew GERSHAYIM preceded by Hebrew",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.6",
+ "data": "\u05d0\u05f4\u05d1",
+ "valid": true
+ },
+ {
+ "description": "KATAKANA MIDDLE DOT with no Hiragana, Katakana, or Han",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
+ "data": "def\u30fbabc",
+ "valid": false
+ },
+ {
+ "description": "KATAKANA MIDDLE DOT with no other characters",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
+ "data": "\u30fb",
+ "valid": false
+ },
+ {
+ "description": "KATAKANA MIDDLE DOT with Hiragana",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
+ "data": "\u30fb\u3041",
+ "valid": true
+ },
+ {
+ "description": "KATAKANA MIDDLE DOT with Katakana",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
+ "data": "\u30fb\u30a1",
+ "valid": true
+ },
+ {
+ "description": "KATAKANA MIDDLE DOT with Han",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
+ "data": "\u30fb\u4e08",
+ "valid": true
+ },
+ {
+ "description": "Arabic-Indic digits mixed with Extended Arabic-Indic digits",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.8",
+ "data": "\u0660\u06f0",
+ "valid": false
+ },
+ {
+ "description": "Arabic-Indic digits not mixed with Extended Arabic-Indic digits",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.8",
+ "data": "\u0628\u0660\u0628",
+ "valid": true
+ },
+ {
+ "description": "Extended Arabic-Indic digits not mixed with Arabic-Indic digits",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.9",
+ "data": "\u06f00",
+ "valid": true
+ },
+ {
+ "description": "ZERO WIDTH JOINER not preceded by Virama",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.2 https://www.unicode.org/review/pr-37.pdf",
+ "data": "\u0915\u200d\u0937",
+ "valid": false
+ },
+ {
+ "description": "ZERO WIDTH JOINER not preceded by anything",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.2 https://www.unicode.org/review/pr-37.pdf",
+ "data": "\u200d\u0937",
+ "valid": false
+ },
+ {
+ "description": "ZERO WIDTH JOINER preceded by Virama",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.2 https://www.unicode.org/review/pr-37.pdf",
+ "data": "\u0915\u094d\u200d\u0937",
+ "valid": true
+ },
+ {
+ "description": "ZERO WIDTH NON-JOINER preceded by Virama",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1",
+ "data": "\u0915\u094d\u200c\u0937",
+ "valid": true
+ },
+ {
+ "description": "ZERO WIDTH NON-JOINER not preceded by Virama but matches regexp",
+ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement",
+ "data": "\u0628\u064a\u200c\u0628\u064a",
+ "valid": true
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/ipv4.json b/json/tests/draft-next/optional/format/ipv4.json
new file mode 100644
index 0000000..6b166c7
--- /dev/null
+++ b/json/tests/draft-next/optional/format/ipv4.json
@@ -0,0 +1,84 @@
+[
+ {
+ "description": "validation of IP addresses",
+ "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
+ },
+ {
+ "description": "an IP address with too many components",
+ "data": "127.0.0.0.1",
+ "valid": false
+ },
+ {
+ "description": "an IP address with out-of-range values",
+ "data": "256.256.256.256",
+ "valid": false
+ },
+ {
+ "description": "an IP address without 4 components",
+ "data": "127.0",
+ "valid": false
+ },
+ {
+ "description": "an IP address as an integer",
+ "data": "0x7f000001",
+ "valid": false
+ },
+ {
+ "description": "an IP address as an integer (decimal)",
+ "data": "2130706433",
+ "valid": false
+ },
+ {
+ "description": "leading zeroes should be rejected, as they are treated as octals",
+ "comment": "see https://sick.codes/universal-netmask-npm-package-used-by-270000-projects-vulnerable-to-octal-input-data-server-side-request-forgery-remote-file-inclusion-local-file-inclusion-and-more-cve-2021-28918/",
+ "data": "087.10.0.1",
+ "valid": false
+ },
+ {
+ "description": "value without leading zero is valid",
+ "data": "87.10.0.1",
+ "valid": true
+ },
+ {
+ "description": "non-ascii digits should be rejected",
+ "data": "1২7.0.0.1",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/ipv6.json b/json/tests/draft-next/optional/format/ipv6.json
new file mode 100644
index 0000000..6379927
--- /dev/null
+++ b/json/tests/draft-next/optional/format/ipv6.json
@@ -0,0 +1,208 @@
+[
+ {
+ "description": "validation of IPv6 addresses",
+ "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
+ },
+ {
+ "description": "an IPv6 address with out-of-range values",
+ "data": "12345::",
+ "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
+ },
+ {
+ "description": "an IPv6 address containing illegal characters",
+ "data": "::laptop",
+ "valid": false
+ },
+ {
+ "description": "no digits is valid",
+ "data": "::",
+ "valid": true
+ },
+ {
+ "description": "leading colons is valid",
+ "data": "::42:ff:1",
+ "valid": true
+ },
+ {
+ "description": "trailing colons is valid",
+ "data": "d6::",
+ "valid": true
+ },
+ {
+ "description": "missing leading octet is invalid",
+ "data": ":2:3:4:5:6:7:8",
+ "valid": false
+ },
+ {
+ "description": "missing trailing octet is invalid",
+ "data": "1:2:3:4:5:6:7:",
+ "valid": false
+ },
+ {
+ "description": "missing leading octet with omitted octets later",
+ "data": ":2:3:4::8",
+ "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
+ },
+ {
+ "description": "mixed format with the ipv4 section as decimal octets",
+ "data": "1::d6:192.168.0.1",
+ "valid": true
+ },
+ {
+ "description": "mixed format with double colons between the sections",
+ "data": "1:2::192.168.0.1",
+ "valid": true
+ },
+ {
+ "description": "mixed format with ipv4 section with octet out of range",
+ "data": "1::2:192.168.256.1",
+ "valid": false
+ },
+ {
+ "description": "mixed format with ipv4 section with a hex octet",
+ "data": "1::2:192.168.ff.1",
+ "valid": false
+ },
+ {
+ "description": "mixed format with leading double colons (ipv4-mapped ipv6 address)",
+ "data": "::ffff:192.168.0.1",
+ "valid": true
+ },
+ {
+ "description": "triple colons is invalid",
+ "data": "1:2:3:4:5:::8",
+ "valid": false
+ },
+ {
+ "description": "8 octets",
+ "data": "1:2:3:4:5:6:7:8",
+ "valid": true
+ },
+ {
+ "description": "insufficient octets without double colons",
+ "data": "1:2:3:4:5:6:7",
+ "valid": false
+ },
+ {
+ "description": "no colons is invalid",
+ "data": "1",
+ "valid": false
+ },
+ {
+ "description": "ipv4 is not ipv6",
+ "data": "127.0.0.1",
+ "valid": false
+ },
+ {
+ "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
+ },
+ {
+ "description": "non-ascii digits should be rejected",
+ "data": "1:2:3:4:5:6:7:৪",
+ "valid": false
+ },
+ {
+ "description": "non-ascii digits should be rejected in the ipv4 portion also",
+ "data": "1:2::192.16৪.0.1",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/iri-reference.json b/json/tests/draft-next/optional/format/iri-reference.json
new file mode 100644
index 0000000..c6b4c22
--- /dev/null
+++ b/json/tests/draft-next/optional/format/iri-reference.json
@@ -0,0 +1,73 @@
+[
+ {
+ "description": "validation of IRI References",
+ "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
+ },
+ {
+ "description": "a valid protocol-relative IRI Reference",
+ "data": "//ƒøø.ßår/?∂éœ=πîx#πîüx",
+ "valid": true
+ },
+ {
+ "description": "a valid relative IRI Reference",
+ "data": "/âππ",
+ "valid": true
+ },
+ {
+ "description": "an invalid IRI Reference",
+ "data": "\\\\WINDOWS\\filëßåré",
+ "valid": false
+ },
+ {
+ "description": "a valid IRI Reference",
+ "data": "âππ",
+ "valid": true
+ },
+ {
+ "description": "a valid IRI fragment",
+ "data": "#ƒrägmênt",
+ "valid": true
+ },
+ {
+ "description": "an invalid IRI fragment",
+ "data": "#ƒräg\\mênt",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/iri.json b/json/tests/draft-next/optional/format/iri.json
new file mode 100644
index 0000000..a0d12ae
--- /dev/null
+++ b/json/tests/draft-next/optional/format/iri.json
@@ -0,0 +1,83 @@
+[
+ {
+ "description": "validation of IRIs",
+ "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
+ },
+ {
+ "description": "a valid IRI with anchor tag and parentheses",
+ "data": "http://ƒøø.com/blah_(wîkïpédiå)_blah#ßité-1",
+ "valid": true
+ },
+ {
+ "description": "a valid IRI with URL-encoded stuff",
+ "data": "http://ƒøø.ßår/?q=Test%20URL-encoded%20stuff",
+ "valid": true
+ },
+ {
+ "description": "a valid IRI with many special characters",
+ "data": "http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com",
+ "valid": true
+ },
+ {
+ "description": "a valid IRI based on IPv6",
+ "data": "http://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]",
+ "valid": true
+ },
+ {
+ "description": "an invalid IRI based on IPv6",
+ "data": "http://2001:0db8:85a3:0000:0000:8a2e:0370:7334",
+ "valid": false
+ },
+ {
+ "description": "an invalid relative IRI Reference",
+ "data": "/abc",
+ "valid": false
+ },
+ {
+ "description": "an invalid IRI",
+ "data": "\\\\WINDOWS\\filëßåré",
+ "valid": false
+ },
+ {
+ "description": "an invalid IRI though valid IRI reference",
+ "data": "âππ",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/json-pointer.json b/json/tests/draft-next/optional/format/json-pointer.json
new file mode 100644
index 0000000..a0346b5
--- /dev/null
+++ b/json/tests/draft-next/optional/format/json-pointer.json
@@ -0,0 +1,198 @@
+[
+ {
+ "description": "validation of JSON-pointers (JSON String Representation)",
+ "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
+ },
+ {
+ "description": "not a valid JSON-pointer (~ not escaped)",
+ "data": "/foo/bar~",
+ "valid": false
+ },
+ {
+ "description": "valid JSON-pointer with empty segment",
+ "data": "/foo//bar",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer with the last empty segment",
+ "data": "/foo/bar/",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer as stated in RFC 6901 #1",
+ "data": "",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer as stated in RFC 6901 #2",
+ "data": "/foo",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer as stated in RFC 6901 #3",
+ "data": "/foo/0",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer as stated in RFC 6901 #4",
+ "data": "/",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer as stated in RFC 6901 #5",
+ "data": "/a~1b",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer as stated in RFC 6901 #6",
+ "data": "/c%d",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer as stated in RFC 6901 #7",
+ "data": "/e^f",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer as stated in RFC 6901 #8",
+ "data": "/g|h",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer as stated in RFC 6901 #9",
+ "data": "/i\\j",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer as stated in RFC 6901 #10",
+ "data": "/k\"l",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer as stated in RFC 6901 #11",
+ "data": "/ ",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer as stated in RFC 6901 #12",
+ "data": "/m~0n",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer used adding to the last array position",
+ "data": "/foo/-",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer (- used as object member name)",
+ "data": "/foo/-/bar",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer (multiple escaped characters)",
+ "data": "/~1~0~0~1~1",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer (escaped with fraction part) #1",
+ "data": "/~1.1",
+ "valid": true
+ },
+ {
+ "description": "valid JSON-pointer (escaped with fraction part) #2",
+ "data": "/~0.1",
+ "valid": true
+ },
+ {
+ "description": "not a valid JSON-pointer (URI Fragment Identifier) #1",
+ "data": "#",
+ "valid": false
+ },
+ {
+ "description": "not a valid JSON-pointer (URI Fragment Identifier) #2",
+ "data": "#/",
+ "valid": false
+ },
+ {
+ "description": "not a valid JSON-pointer (URI Fragment Identifier) #3",
+ "data": "#a",
+ "valid": false
+ },
+ {
+ "description": "not a valid JSON-pointer (some escaped, but not all) #1",
+ "data": "/~0~",
+ "valid": false
+ },
+ {
+ "description": "not a valid JSON-pointer (some escaped, but not all) #2",
+ "data": "/~0/~",
+ "valid": false
+ },
+ {
+ "description": "not a valid JSON-pointer (wrong escape character) #1",
+ "data": "/~2",
+ "valid": false
+ },
+ {
+ "description": "not a valid JSON-pointer (wrong escape character) #2",
+ "data": "/~-1",
+ "valid": false
+ },
+ {
+ "description": "not a valid JSON-pointer (multiple characters not escaped)",
+ "data": "/~~",
+ "valid": false
+ },
+ {
+ "description": "not a valid JSON-pointer (isn't empty nor starts with /) #1",
+ "data": "a",
+ "valid": false
+ },
+ {
+ "description": "not a valid JSON-pointer (isn't empty nor starts with /) #2",
+ "data": "0",
+ "valid": false
+ },
+ {
+ "description": "not a valid JSON-pointer (isn't empty nor starts with /) #3",
+ "data": "a/a",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/regex.json b/json/tests/draft-next/optional/format/regex.json
new file mode 100644
index 0000000..3449177
--- /dev/null
+++ b/json/tests/draft-next/optional/format/regex.json
@@ -0,0 +1,48 @@
+[
+ {
+ "description": "validation of regular expressions",
+ "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
+ },
+ {
+ "description": "a regular expression with unclosed parens is invalid",
+ "data": "^(abc]",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/relative-json-pointer.json b/json/tests/draft-next/optional/format/relative-json-pointer.json
new file mode 100644
index 0000000..9309986
--- /dev/null
+++ b/json/tests/draft-next/optional/format/relative-json-pointer.json
@@ -0,0 +1,83 @@
+[
+ {
+ "description": "validation of Relative JSON Pointers (RJP)",
+ "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
+ },
+ {
+ "description": "a valid downwards RJP",
+ "data": "0/foo/bar",
+ "valid": true
+ },
+ {
+ "description": "a valid up and then down RJP, with array index",
+ "data": "2/0/baz/1/zip",
+ "valid": true
+ },
+ {
+ "description": "a valid RJP taking the member or index name",
+ "data": "0#",
+ "valid": true
+ },
+ {
+ "description": "an invalid RJP that is a valid JSON Pointer",
+ "data": "/foo/bar",
+ "valid": false
+ },
+ {
+ "description": "negative prefix",
+ "data": "-1/foo/bar",
+ "valid": false
+ },
+ {
+ "description": "## is not a valid json-pointer",
+ "data": "0##",
+ "valid": false
+ },
+ {
+ "description": "zero cannot be followed by other digits, plus json-pointer",
+ "data": "01/a",
+ "valid": false
+ },
+ {
+ "description": "zero cannot be followed by other digits, plus octothorpe",
+ "data": "01#",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/time.json b/json/tests/draft-next/optional/format/time.json
new file mode 100644
index 0000000..5011d78
--- /dev/null
+++ b/json/tests/draft-next/optional/format/time.json
@@ -0,0 +1,198 @@
+[
+ {
+ "description": "validation of time strings",
+ "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
+ },
+ {
+ "description": "a valid time string with leap second, Zulu",
+ "data": "23:59:60Z",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, Zulu (wrong hour)",
+ "data": "22:59:60Z",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, Zulu (wrong minute)",
+ "data": "23:58:60Z",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, zero time-offset",
+ "data": "23:59:60+00:00",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, zero time-offset (wrong hour)",
+ "data": "22:59:60+00:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, zero time-offset (wrong minute)",
+ "data": "23:58:60+00:00",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, positive time-offset",
+ "data": "01:29:60+01:30",
+ "valid": true
+ },
+ {
+ "description": "valid leap second, large positive time-offset",
+ "data": "23:29:60+23:30",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, positive time-offset (wrong hour)",
+ "data": "23:59:60+01:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, positive time-offset (wrong minute)",
+ "data": "23:59:60+00:30",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, negative time-offset",
+ "data": "15:59:60-08:00",
+ "valid": true
+ },
+ {
+ "description": "valid leap second, large negative time-offset",
+ "data": "00:29:60-23:30",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, negative time-offset (wrong hour)",
+ "data": "23:59:60-01:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, negative time-offset (wrong minute)",
+ "data": "23:59:60-00:30",
+ "valid": false
+ },
+ {
+ "description": "a valid time string with second fraction",
+ "data": "23:20:50.52Z",
+ "valid": true
+ },
+ {
+ "description": "a valid time string with precise second fraction",
+ "data": "08:30:06.283185Z",
+ "valid": true
+ },
+ {
+ "description": "a valid time string with plus offset",
+ "data": "08:30:06+00:20",
+ "valid": true
+ },
+ {
+ "description": "a valid time string with minus offset",
+ "data": "08:30:06-08:00",
+ "valid": true
+ },
+ {
+ "description": "a valid time string with case-insensitive Z",
+ "data": "08:30:06z",
+ "valid": true
+ },
+ {
+ "description": "an invalid time string with invalid hour",
+ "data": "24:00:00Z",
+ "valid": false
+ },
+ {
+ "description": "an invalid time string with invalid minute",
+ "data": "00:60:00Z",
+ "valid": false
+ },
+ {
+ "description": "an invalid time string with invalid second",
+ "data": "00:00:61Z",
+ "valid": false
+ },
+ {
+ "description": "an invalid time string with invalid leap second (wrong hour)",
+ "data": "22:59:60Z",
+ "valid": false
+ },
+ {
+ "description": "an invalid time string with invalid leap second (wrong minute)",
+ "data": "23:58:60Z",
+ "valid": false
+ },
+ {
+ "description": "an invalid time string with invalid time numoffset hour",
+ "data": "01:02:03+24:00",
+ "valid": false
+ },
+ {
+ "description": "an invalid time string with invalid time numoffset minute",
+ "data": "01:02:03+00:60",
+ "valid": false
+ },
+ {
+ "description": "an invalid time string with invalid time with both Z and numoffset",
+ "data": "01:02:03Z+00:30",
+ "valid": false
+ },
+ {
+ "description": "an invalid offset indicator",
+ "data": "08:30:06 PST",
+ "valid": false
+ },
+ {
+ "description": "only RFC3339 not all of ISO 8601 are valid",
+ "data": "01:01:01,1111",
+ "valid": false
+ },
+ {
+ "description": "no time offset",
+ "data": "12:00:00",
+ "valid": false
+ },
+ {
+ "description": "non-ascii digits should be rejected",
+ "data": "1২:00:00Z",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/uri-reference.json b/json/tests/draft-next/optional/format/uri-reference.json
new file mode 100644
index 0000000..7cdf228
--- /dev/null
+++ b/json/tests/draft-next/optional/format/uri-reference.json
@@ -0,0 +1,73 @@
+[
+ {
+ "description": "validation of URI References",
+ "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
+ },
+ {
+ "description": "a valid protocol-relative URI Reference",
+ "data": "//foo.bar/?baz=qux#quux",
+ "valid": true
+ },
+ {
+ "description": "a valid relative URI Reference",
+ "data": "/abc",
+ "valid": true
+ },
+ {
+ "description": "an invalid URI Reference",
+ "data": "\\\\WINDOWS\\fileshare",
+ "valid": false
+ },
+ {
+ "description": "a valid URI Reference",
+ "data": "abc",
+ "valid": true
+ },
+ {
+ "description": "a valid URI fragment",
+ "data": "#fragment",
+ "valid": true
+ },
+ {
+ "description": "an invalid URI fragment",
+ "data": "#frag\\ment",
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/uri-template.json b/json/tests/draft-next/optional/format/uri-template.json
new file mode 100644
index 0000000..df355c5
--- /dev/null
+++ b/json/tests/draft-next/optional/format/uri-template.json
@@ -0,0 +1,58 @@
+[
+ {
+ "description": "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
+ },
+ {
+ "description": "an invalid uri-template",
+ "data": "http://example.com/dictionary/{term:1}/{term",
+ "valid": false
+ },
+ {
+ "description": "a valid uri-template without variables",
+ "data": "http://example.com/dictionary",
+ "valid": true
+ },
+ {
+ "description": "a valid relative uri-template",
+ "data": "dictionary/{term:1}/{term}",
+ "valid": true
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/format/uri.json b/json/tests/draft-next/optional/format/uri.json
new file mode 100644
index 0000000..792d71a
--- /dev/null
+++ b/json/tests/draft-next/optional/format/uri.json
@@ -0,0 +1,108 @@
+[
+ {
+ "description": "validation of URIs",
+ "schema": { "format": "uri" },
+ "tests": [
+ {
+ "description": "a valid URL with anchor tag",
+ "data": "http://foo.bar/?baz=qux#quux",
+ "valid": true
+ },
+ {
+ "description": "a valid URL with anchor tag and parentheses",
+ "data": "http://foo.com/blah_(wikipedia)_blah#cite-1",
+ "valid": true
+ },
+ {
+ "description": "a valid URL with URL-encoded stuff",
+ "data": "http://foo.bar/?q=Test%20URL-encoded%20stuff",
+ "valid": true
+ },
+ {
+ "description": "a valid puny-coded URL ",
+ "data": "http://xn--nw2a.xn--j6w193g/",
+ "valid": true
+ },
+ {
+ "description": "a valid URL with many special characters",
+ "data": "http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com",
+ "valid": true
+ },
+ {
+ "description": "a valid URL based on IPv4",
+ "data": "http://223.255.255.254",
+ "valid": true
+ },
+ {
+ "description": "a valid URL with ftp scheme",
+ "data": "ftp://ftp.is.co.za/rfc/rfc1808.txt",
+ "valid": true
+ },
+ {
+ "description": "a valid URL for a simple text file",
+ "data": "http://www.ietf.org/rfc/rfc2396.txt",
+ "valid": true
+ },
+ {
+ "description": "a valid URL ",
+ "data": "ldap://[2001:db8::7]/c=GB?objectClass?one",
+ "valid": true
+ },
+ {
+ "description": "a valid mailto URI",
+ "data": "mailto:John.Doe@example.com",
+ "valid": true
+ },
+ {
+ "description": "a valid newsgroup URI",
+ "data": "news:comp.infosystems.www.servers.unix",
+ "valid": true
+ },
+ {
+ "description": "a valid tel URI",
+ "data": "tel:+1-816-555-1212",
+ "valid": true
+ },
+ {
+ "description": "a valid URN",
+ "data": "urn:oasis:names:specification:docbook:dtd:xml:4.1.2",
+ "valid": true
+ },
+ {
+ "description": "an invalid protocol-relative URI Reference",
+ "data": "//foo.bar/?baz=qux#quux",
+ "valid": false
+ },
+ {
+ "description": "an invalid relative URI Reference",
+ "data": "/abc",
+ "valid": false
+ },
+ {
+ "description": "an invalid URI",
+ "data": "\\\\WINDOWS\\fileshare",
+ "valid": false
+ },
+ {
+ "description": "an invalid URI though valid URI reference",
+ "data": "abc",
+ "valid": false
+ },
+ {
+ "description": "an invalid URI with spaces",
+ "data": "http:// shouldfail.com",
+ "valid": false
+ },
+ {
+ "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/draft-next/optional/format/uuid.json b/json/tests/draft-next/optional/format/uuid.json
new file mode 100644
index 0000000..e54cbc0
--- /dev/null
+++ b/json/tests/draft-next/optional/format/uuid.json
@@ -0,0 +1,85 @@
+[
+ {
+ "description": "uuid format",
+ "schema": {
+ "format": "uuid"
+ },
+ "tests": [
+ {
+ "description": "all upper-case",
+ "data": "2EB8AA08-AA98-11EA-B4AA-73B441D16380",
+ "valid": true
+ },
+ {
+ "description": "all lower-case",
+ "data": "2eb8aa08-aa98-11ea-b4aa-73b441d16380",
+ "valid": true
+ },
+ {
+ "description": "mixed case",
+ "data": "2eb8aa08-AA98-11ea-B4Aa-73B441D16380",
+ "valid": true
+ },
+ {
+ "description": "all zeroes is valid",
+ "data": "00000000-0000-0000-0000-000000000000",
+ "valid": true
+ },
+ {
+ "description": "wrong length",
+ "data": "2eb8aa08-aa98-11ea-b4aa-73b441d1638",
+ "valid": false
+ },
+ {
+ "description": "missing section",
+ "data": "2eb8aa08-aa98-11ea-73b441d16380",
+ "valid": false
+ },
+ {
+ "description": "bad characters (not hex)",
+ "data": "2eb8aa08-aa98-11ea-b4ga-73b441d16380",
+ "valid": false
+ },
+ {
+ "description": "no dashes",
+ "data": "2eb8aa08aa9811eab4aa73b441d16380",
+ "valid": false
+ },
+ {
+ "description": "too few dashes",
+ "data": "2eb8aa08aa98-11ea-b4aa73b441d16380",
+ "valid": false
+ },
+ {
+ "description": "too many dashes",
+ "data": "2eb8-aa08-aa98-11ea-b4aa73b44-1d16380",
+ "valid": false
+ },
+ {
+ "description": "dashes in the wrong spot",
+ "data": "2eb8aa08aa9811eab4aa73b441d16380----",
+ "valid": false
+ },
+ {
+ "description": "valid version 4",
+ "data": "98d80576-482e-427f-8434-7f86890ab222",
+ "valid": true
+ },
+ {
+ "description": "valid version 5",
+ "data": "99c17cbb-656f-564a-940f-1a4568f03487",
+ "valid": true
+ },
+ {
+ "description": "hypothetical version 6",
+ "data": "99c17cbb-656f-664a-940f-1a4568f03487",
+ "valid": true
+ },
+ {
+ "description": "hypothetical version 15",
+ "data": "99c17cbb-656f-f64a-940f-1a4568f03487",
+ "valid": true
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/non-bmp-regex.json b/json/tests/draft-next/optional/non-bmp-regex.json
new file mode 100644
index 0000000..dd67af2
--- /dev/null
+++ b/json/tests/draft-next/optional/non-bmp-regex.json
@@ -0,0 +1,82 @@
+[
+ {
+ "description": "Proper UTF-16 surrogate pair handling: pattern",
+ "comment": "Optional because .Net doesn't correctly handle 32-bit Unicode characters",
+ "schema": { "pattern": "^🐲*$" },
+ "tests": [
+ {
+ "description": "matches empty",
+ "data": "",
+ "valid": true
+ },
+ {
+ "description": "matches single",
+ "data": "🐲",
+ "valid": true
+ },
+ {
+ "description": "matches two",
+ "data": "🐲🐲",
+ "valid": true
+ },
+ {
+ "description": "doesn't match one",
+ "data": "🐉",
+ "valid": false
+ },
+ {
+ "description": "doesn't match two",
+ "data": "🐉🐉",
+ "valid": false
+ },
+ {
+ "description": "doesn't match one ASCII",
+ "data": "D",
+ "valid": false
+ },
+ {
+ "description": "doesn't match two ASCII",
+ "data": "DD",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "Proper UTF-16 surrogate pair handling: patternProperties",
+ "comment": "Optional because .Net doesn't correctly handle 32-bit Unicode characters",
+ "schema": {
+ "patternProperties": {
+ "^🐲*$": {
+ "type": "integer"
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "matches empty",
+ "data": { "": 1 },
+ "valid": true
+ },
+ {
+ "description": "matches single",
+ "data": { "🐲": 1 },
+ "valid": true
+ },
+ {
+ "description": "matches two",
+ "data": { "🐲🐲": 1 },
+ "valid": true
+ },
+ {
+ "description": "doesn't match one",
+ "data": { "🐲": "hello" },
+ "valid": false
+ },
+ {
+ "description": "doesn't match two",
+ "data": { "🐲🐲": "hello" },
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft-next/optional/refOfUnknownKeyword.json b/json/tests/draft-next/optional/refOfUnknownKeyword.json
new file mode 100644
index 0000000..5b150df
--- /dev/null
+++ b/json/tests/draft-next/optional/refOfUnknownKeyword.json
@@ -0,0 +1,44 @@
+[
+ {
+ "description": "reference of a root arbitrary keyword ",
+ "schema": {
+ "unknown-keyword": {"type": "integer"},
+ "properties": {
+ "bar": {"$ref": "#/unknown-keyword"}
+ }
+ },
+ "tests": [
+ {
+ "description": "match",
+ "data": {"bar": 3},
+ "valid": true
+ },
+ {
+ "description": "mismatch",
+ "data": {"bar": true},
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "reference of an arbitrary keyword of a sub-schema",
+ "schema": {
+ "properties": {
+ "foo": {"unknown-keyword": {"type": "integer"}},
+ "bar": {"$ref": "#/properties/foo/unknown-keyword"}
+ }
+ },
+ "tests": [
+ {
+ "description": "match",
+ "data": {"bar": 3},
+ "valid": true
+ },
+ {
+ "description": "mismatch",
+ "data": {"bar": true},
+ "valid": false
+ }
+ ]
+ }
+]