summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2020-06-20 11:52:09 -0400
committerJulian Berman <Julian@GrayVines.com>2020-06-20 11:52:09 -0400
commit64619d396c662823d9b4a7698cf2632a29adaafd (patch)
tree76b6961e25cbe773604abc6eec8ba69d9b3716fc
parent9ffc81e628d0da306ab18a4579282a6cf0e18a6d (diff)
parent72d5a27256bb3029671c2ec635be05834151dd50 (diff)
downloadjsonschema-64619d396c662823d9b4a7698cf2632a29adaafd.tar.gz
Merge commit '72d5a27256bb3029671c2ec635be05834151dd50'
* commit '72d5a27256bb3029671c2ec635be05834151dd50': Squashed 'json/' changes from 57001d26b..fc05651cc
-rw-r--r--json/README.md5
-rw-r--r--json/tests/draft2019-09/format.json36
-rw-r--r--json/tests/draft2019-09/optional/ecmascript-regex.json100
-rw-r--r--json/tests/draft2019-09/optional/format/idn-email.json10
-rw-r--r--json/tests/draft2019-09/optional/format/ipv6.json40
-rw-r--r--json/tests/draft2019-09/optional/format/uuid.json70
-rw-r--r--json/tests/draft2019-09/ref.json25
-rw-r--r--json/tests/draft3/optional/format/ipv6.json40
-rw-r--r--json/tests/draft3/ref.json25
-rw-r--r--json/tests/draft4/optional/ecmascript-regex.json100
-rw-r--r--json/tests/draft4/optional/format/ipv6.json40
-rw-r--r--json/tests/draft4/ref.json25
-rw-r--r--json/tests/draft6/optional/ecmascript-regex.json100
-rw-r--r--json/tests/draft6/optional/format/ipv6.json40
-rw-r--r--json/tests/draft6/ref.json25
-rw-r--r--json/tests/draft7/optional/ecmascript-regex.json100
-rw-r--r--json/tests/draft7/optional/format/idn-email.json10
-rw-r--r--json/tests/draft7/optional/format/ipv6.json40
-rw-r--r--json/tests/draft7/ref.json25
19 files changed, 836 insertions, 20 deletions
diff --git a/json/README.md b/json/README.md
index 540ce60..2b541ef 100644
--- a/json/README.md
+++ b/json/README.md
@@ -85,6 +85,10 @@ This suite is being used by:
* [jsck](https://github.com/pandastrike/jsck)
+### Common Lisp
+
+* [json-schema](https://github.com/fisxoj/json-schema)
+
### C++
* [Modern C++ JSON schema validator](https://github.com/pboettch/json-schema-validator)
@@ -179,6 +183,7 @@ which also welcomes your contributions!
### Rust
+* [jsonschema](https://github.com/Stranger6667/jsonschema-rs)
* [valico](https://github.com/rustless/valico)
### Swift
diff --git a/json/tests/draft2019-09/format.json b/json/tests/draft2019-09/format.json
index 93305f5..bb725e2 100644
--- a/json/tests/draft2019-09/format.json
+++ b/json/tests/draft2019-09/format.json
@@ -610,5 +610,41 @@
"valid": true
}
]
+ },
+ {
+ "description": "validation of UUIDs",
+ "schema": { "format": "uuid" },
+ "tests": [
+ {
+ "description": "ignores integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "ignores floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "ignores objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "ignores arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "ignores booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "ignores null",
+ "data": null,
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft2019-09/optional/ecmascript-regex.json b/json/tests/draft2019-09/optional/ecmascript-regex.json
index 106c33b..b9412e0 100644
--- a/json/tests/draft2019-09/optional/ecmascript-regex.json
+++ b/json/tests/draft2019-09/optional/ecmascript-regex.json
@@ -154,7 +154,7 @@
]
},
{
- "description": "ECMA 262 \\w matches everything but ascii letters",
+ "description": "ECMA 262 \\W matches everything but ascii letters",
"schema": {
"type": "string",
"pattern": "^\\W$"
@@ -173,7 +173,7 @@
]
},
{
- "description": "ECMA 262 \\s matches ascii whitespace only",
+ "description": "ECMA 262 \\s matches whitespace",
"schema": {
"type": "string",
"pattern": "^\\s$"
@@ -185,14 +185,59 @@
"valid": true
},
{
- "description": "latin-1 non-breaking-space does not match (unlike e.g. Python)",
+ "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 ascii whitespace",
+ "description": "ECMA 262 \\S matches everything but whitespace",
"schema": {
"type": "string",
"pattern": "^\\S$"
@@ -204,8 +249,53 @@
"valid": false
},
{
- "description": "latin-1 non-breaking-space matches (unlike e.g. Python)",
+ "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
}
]
diff --git a/json/tests/draft2019-09/optional/format/idn-email.json b/json/tests/draft2019-09/optional/format/idn-email.json
index 637409e..552d106 100644
--- a/json/tests/draft2019-09/optional/format/idn-email.json
+++ b/json/tests/draft2019-09/optional/format/idn-email.json
@@ -12,6 +12,16 @@
"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/draft2019-09/optional/format/ipv6.json b/json/tests/draft2019-09/optional/format/ipv6.json
index f67559b..4b44dad 100644
--- a/json/tests/draft2019-09/optional/format/ipv6.json
+++ b/json/tests/draft2019-09/optional/format/ipv6.json
@@ -22,6 +22,46 @@
"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": "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
}
]
}
diff --git a/json/tests/draft2019-09/optional/format/uuid.json b/json/tests/draft2019-09/optional/format/uuid.json
new file mode 100644
index 0000000..45bf349
--- /dev/null
+++ b/json/tests/draft2019-09/optional/format/uuid.json
@@ -0,0 +1,70 @@
+[
+ {
+ "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": "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/draft2019-09/ref.json b/json/tests/draft2019-09/ref.json
index a756eb0..97f7054 100644
--- a/json/tests/draft2019-09/ref.json
+++ b/json/tests/draft2019-09/ref.json
@@ -212,6 +212,31 @@
]
},
{
+ "description": "property named $ref, containing an actual $ref",
+ "schema": {
+ "properties": {
+ "$ref": {"$ref": "#/$defs/is-string"}
+ },
+ "$defs": {
+ "is-string": {
+ "type": "string"
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "property named $ref valid",
+ "data": {"$ref": "a"},
+ "valid": true
+ },
+ {
+ "description": "property named $ref invalid",
+ "data": {"$ref": 2},
+ "valid": false
+ }
+ ]
+ },
+ {
"description": "$ref to boolean schema true",
"schema": {
"$ref": "#/$defs/bool",
diff --git a/json/tests/draft3/optional/format/ipv6.json b/json/tests/draft3/optional/format/ipv6.json
index f67559b..131edb8 100644
--- a/json/tests/draft3/optional/format/ipv6.json
+++ b/json/tests/draft3/optional/format/ipv6.json
@@ -22,6 +22,46 @@
"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": "::1",
+ "valid": true
+ },
+ {
+ "description": "trailing colons is valid",
+ "data": "d6::",
+ "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
}
]
}
diff --git a/json/tests/draft3/ref.json b/json/tests/draft3/ref.json
index bd6b777..74e963c 100644
--- a/json/tests/draft3/ref.json
+++ b/json/tests/draft3/ref.json
@@ -174,6 +174,31 @@
]
},
{
+ "description": "property named $ref, containing an actual $ref",
+ "schema": {
+ "properties": {
+ "$ref": {"$ref": "#/definitions/is-string"}
+ },
+ "definitions": {
+ "is-string": {
+ "type": "string"
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "property named $ref valid",
+ "data": {"$ref": "a"},
+ "valid": true
+ },
+ {
+ "description": "property named $ref invalid",
+ "data": {"$ref": 2},
+ "valid": false
+ }
+ ]
+ },
+ {
"description": "remote ref, containing refs itself",
"schema": {"$ref": "http://json-schema.org/draft-03/schema#"},
"tests": [
diff --git a/json/tests/draft4/optional/ecmascript-regex.json b/json/tests/draft4/optional/ecmascript-regex.json
index 106c33b..b9412e0 100644
--- a/json/tests/draft4/optional/ecmascript-regex.json
+++ b/json/tests/draft4/optional/ecmascript-regex.json
@@ -154,7 +154,7 @@
]
},
{
- "description": "ECMA 262 \\w matches everything but ascii letters",
+ "description": "ECMA 262 \\W matches everything but ascii letters",
"schema": {
"type": "string",
"pattern": "^\\W$"
@@ -173,7 +173,7 @@
]
},
{
- "description": "ECMA 262 \\s matches ascii whitespace only",
+ "description": "ECMA 262 \\s matches whitespace",
"schema": {
"type": "string",
"pattern": "^\\s$"
@@ -185,14 +185,59 @@
"valid": true
},
{
- "description": "latin-1 non-breaking-space does not match (unlike e.g. Python)",
+ "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 ascii whitespace",
+ "description": "ECMA 262 \\S matches everything but whitespace",
"schema": {
"type": "string",
"pattern": "^\\S$"
@@ -204,8 +249,53 @@
"valid": false
},
{
- "description": "latin-1 non-breaking-space matches (unlike e.g. Python)",
+ "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
}
]
diff --git a/json/tests/draft4/optional/format/ipv6.json b/json/tests/draft4/optional/format/ipv6.json
index f67559b..131edb8 100644
--- a/json/tests/draft4/optional/format/ipv6.json
+++ b/json/tests/draft4/optional/format/ipv6.json
@@ -22,6 +22,46 @@
"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": "::1",
+ "valid": true
+ },
+ {
+ "description": "trailing colons is valid",
+ "data": "d6::",
+ "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
}
]
}
diff --git a/json/tests/draft4/ref.json b/json/tests/draft4/ref.json
index 895c880..fc3e94b 100644
--- a/json/tests/draft4/ref.json
+++ b/json/tests/draft4/ref.json
@@ -210,6 +210,31 @@
]
},
{
+ "description": "property named $ref, containing an actual $ref",
+ "schema": {
+ "properties": {
+ "$ref": {"$ref": "#/definitions/is-string"}
+ },
+ "definitions": {
+ "is-string": {
+ "type": "string"
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "property named $ref valid",
+ "data": {"$ref": "a"},
+ "valid": true
+ },
+ {
+ "description": "property named $ref invalid",
+ "data": {"$ref": 2},
+ "valid": false
+ }
+ ]
+ },
+ {
"description": "Recursive references between schemas",
"schema": {
"id": "http://localhost:1234/tree",
diff --git a/json/tests/draft6/optional/ecmascript-regex.json b/json/tests/draft6/optional/ecmascript-regex.json
index 106c33b..b9412e0 100644
--- a/json/tests/draft6/optional/ecmascript-regex.json
+++ b/json/tests/draft6/optional/ecmascript-regex.json
@@ -154,7 +154,7 @@
]
},
{
- "description": "ECMA 262 \\w matches everything but ascii letters",
+ "description": "ECMA 262 \\W matches everything but ascii letters",
"schema": {
"type": "string",
"pattern": "^\\W$"
@@ -173,7 +173,7 @@
]
},
{
- "description": "ECMA 262 \\s matches ascii whitespace only",
+ "description": "ECMA 262 \\s matches whitespace",
"schema": {
"type": "string",
"pattern": "^\\s$"
@@ -185,14 +185,59 @@
"valid": true
},
{
- "description": "latin-1 non-breaking-space does not match (unlike e.g. Python)",
+ "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 ascii whitespace",
+ "description": "ECMA 262 \\S matches everything but whitespace",
"schema": {
"type": "string",
"pattern": "^\\S$"
@@ -204,8 +249,53 @@
"valid": false
},
{
- "description": "latin-1 non-breaking-space matches (unlike e.g. Python)",
+ "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
}
]
diff --git a/json/tests/draft6/optional/format/ipv6.json b/json/tests/draft6/optional/format/ipv6.json
index f67559b..131edb8 100644
--- a/json/tests/draft6/optional/format/ipv6.json
+++ b/json/tests/draft6/optional/format/ipv6.json
@@ -22,6 +22,46 @@
"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": "::1",
+ "valid": true
+ },
+ {
+ "description": "trailing colons is valid",
+ "data": "d6::",
+ "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
}
]
}
diff --git a/json/tests/draft6/ref.json b/json/tests/draft6/ref.json
index 6c29f22..8eaba56 100644
--- a/json/tests/draft6/ref.json
+++ b/json/tests/draft6/ref.json
@@ -210,6 +210,31 @@
]
},
{
+ "description": "property named $ref, containing an actual $ref",
+ "schema": {
+ "properties": {
+ "$ref": {"$ref": "#/definitions/is-string"}
+ },
+ "definitions": {
+ "is-string": {
+ "type": "string"
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "property named $ref valid",
+ "data": {"$ref": "a"},
+ "valid": true
+ },
+ {
+ "description": "property named $ref invalid",
+ "data": {"$ref": 2},
+ "valid": false
+ }
+ ]
+ },
+ {
"description": "$ref to boolean schema true",
"schema": {
"$ref": "#/definitions/bool",
diff --git a/json/tests/draft7/optional/ecmascript-regex.json b/json/tests/draft7/optional/ecmascript-regex.json
index 106c33b..b9412e0 100644
--- a/json/tests/draft7/optional/ecmascript-regex.json
+++ b/json/tests/draft7/optional/ecmascript-regex.json
@@ -154,7 +154,7 @@
]
},
{
- "description": "ECMA 262 \\w matches everything but ascii letters",
+ "description": "ECMA 262 \\W matches everything but ascii letters",
"schema": {
"type": "string",
"pattern": "^\\W$"
@@ -173,7 +173,7 @@
]
},
{
- "description": "ECMA 262 \\s matches ascii whitespace only",
+ "description": "ECMA 262 \\s matches whitespace",
"schema": {
"type": "string",
"pattern": "^\\s$"
@@ -185,14 +185,59 @@
"valid": true
},
{
- "description": "latin-1 non-breaking-space does not match (unlike e.g. Python)",
+ "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 ascii whitespace",
+ "description": "ECMA 262 \\S matches everything but whitespace",
"schema": {
"type": "string",
"pattern": "^\\S$"
@@ -204,8 +249,53 @@
"valid": false
},
{
- "description": "latin-1 non-breaking-space matches (unlike e.g. Python)",
+ "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
}
]
diff --git a/json/tests/draft7/optional/format/idn-email.json b/json/tests/draft7/optional/format/idn-email.json
index 637409e..552d106 100644
--- a/json/tests/draft7/optional/format/idn-email.json
+++ b/json/tests/draft7/optional/format/idn-email.json
@@ -12,6 +12,16 @@
"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/draft7/optional/format/ipv6.json b/json/tests/draft7/optional/format/ipv6.json
index f67559b..131edb8 100644
--- a/json/tests/draft7/optional/format/ipv6.json
+++ b/json/tests/draft7/optional/format/ipv6.json
@@ -22,6 +22,46 @@
"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": "::1",
+ "valid": true
+ },
+ {
+ "description": "trailing colons is valid",
+ "data": "d6::",
+ "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
}
]
}
diff --git a/json/tests/draft7/ref.json b/json/tests/draft7/ref.json
index 9f1d81a..5a8602e 100644
--- a/json/tests/draft7/ref.json
+++ b/json/tests/draft7/ref.json
@@ -210,6 +210,31 @@
]
},
{
+ "description": "property named $ref, containing an actual $ref",
+ "schema": {
+ "properties": {
+ "$ref": {"$ref": "#/definitions/is-string"}
+ },
+ "definitions": {
+ "is-string": {
+ "type": "string"
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "property named $ref valid",
+ "data": {"$ref": "a"},
+ "valid": true
+ },
+ {
+ "description": "property named $ref invalid",
+ "data": {"$ref": 2},
+ "valid": false
+ }
+ ]
+ },
+ {
"description": "$ref to boolean schema true",
"schema": {
"$ref": "#/definitions/bool",