summaryrefslogtreecommitdiff
path: root/json
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2019-11-29 09:55:35 -0500
committerJulian Berman <Julian@GrayVines.com>2019-11-29 09:55:35 -0500
commitee5ee494c87be0fe9a1b9d7b05247ba3c59f0d3e (patch)
tree59016a1abfc58b55358c7a97f58d41bcd6d87ce8 /json
parent702ff13807b33faad01d0a97070e026cb3e778a3 (diff)
parent5195dd8a672a52ac1fdb597665812bda506f86ab (diff)
downloadjsonschema-ee5ee494c87be0fe9a1b9d7b05247ba3c59f0d3e.tar.gz
Merge commit '5195dd8a672a52ac1fdb597665812bda506f86ab'
* commit '5195dd8a672a52ac1fdb597665812bda506f86ab': Squashed 'json/' changes from 689d2f28..0f344a69
Diffstat (limited to 'json')
-rw-r--r--json/README.md13
-rw-r--r--json/tests/draft2019-09/oneOf.json42
-rw-r--r--json/tests/draft2019-09/optional/ecmascript-regex.json8
-rw-r--r--json/tests/draft2019-09/unevaluatedProperties.json34
-rw-r--r--json/tests/draft4/oneOf.json42
-rw-r--r--json/tests/draft4/optional/ecmascript-regex.json8
-rw-r--r--json/tests/draft6/oneOf.json42
-rw-r--r--json/tests/draft6/optional/ecmascript-regex.json8
-rw-r--r--json/tests/draft7/oneOf.json42
-rw-r--r--json/tests/draft7/optional/ecmascript-regex.json8
10 files changed, 227 insertions, 20 deletions
diff --git a/json/README.md b/json/README.md
index f65934c..1bc4ef3 100644
--- a/json/README.md
+++ b/json/README.md
@@ -52,10 +52,15 @@ they should be valid or invalid.
Coverage
--------
-Drafts 03, 04, 06, and 07 should have full coverage, with drafts 06 and 07
-being considered current and actively supported. Bug fixes will be made as
-needed for draft-04 as it is still the most widely used, while draft-03
-is long since deprecated.
+Drafts 07, 06, 04 and 03 should have full coverage, with drafts 06 and
+07 being considered current and actively supported.
+
+Draft 2019-09 support is under development. Contributions are very
+welcome, especially from implementers as they add support to their own
+implementations.
+
+Bug fixes will be made as needed for draft-04 as it is still the most
+widely used, while draft-03 is long since deprecated.
If you see anything missing from the current supported drafts, or incorrect
on any draft still accepting bug fixes, please file an issue or submit a PR.
diff --git a/json/tests/draft2019-09/oneOf.json b/json/tests/draft2019-09/oneOf.json
index 57640b7..76ca96c 100644
--- a/json/tests/draft2019-09/oneOf.json
+++ b/json/tests/draft2019-09/oneOf.json
@@ -202,5 +202,47 @@
"valid": false
}
]
+ },
+ {
+ "description": "oneOf with missing optional property",
+ "schema": {
+ "oneOf": [
+ {
+ "properties": {
+ "bar": true,
+ "baz": true
+ },
+ "required": ["bar"]
+ },
+ {
+ "properties": {
+ "foo": true
+ },
+ "required": ["foo"]
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "first oneOf valid",
+ "data": {"bar": 8},
+ "valid": true
+ },
+ {
+ "description": "second oneOf valid",
+ "data": {"foo": "foo"},
+ "valid": true
+ },
+ {
+ "description": "both oneOf valid",
+ "data": {"foo": "foo", "bar": 8},
+ "valid": false
+ },
+ {
+ "description": "neither oneOf valid",
+ "data": {"baz": "quux"},
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft2019-09/optional/ecmascript-regex.json b/json/tests/draft2019-09/optional/ecmascript-regex.json
index d82e0fe..106c33b 100644
--- a/json/tests/draft2019-09/optional/ecmascript-regex.json
+++ b/json/tests/draft2019-09/optional/ecmascript-regex.json
@@ -30,20 +30,20 @@
]
},
{
- "description": "ECMA 262 regex converts \\a to ascii BEL",
+ "description": "ECMA 262 regex converts \\t to horizontal tab",
"schema": {
"type": "string",
- "pattern": "^\\a$"
+ "pattern": "^\\t$"
},
"tests": [
{
"description": "does not match",
- "data": "\\a",
+ "data": "\\t",
"valid": false
},
{
"description": "matches",
- "data": "\u0007",
+ "data": "\u0009",
"valid": true
}
]
diff --git a/json/tests/draft2019-09/unevaluatedProperties.json b/json/tests/draft2019-09/unevaluatedProperties.json
new file mode 100644
index 0000000..f4096e1
--- /dev/null
+++ b/json/tests/draft2019-09/unevaluatedProperties.json
@@ -0,0 +1,34 @@
+[
+ {
+ "description": "can peer inside allOf, results in no-op",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "unevaluatedProperties": false,
+ "allOf": [
+ {
+ "properties": {
+ "foo": { "type": ["string", "null"] },
+ "bar": { "type": ["string", "null"] }
+ }
+ },
+ {
+ "additionalProperties": {
+ "not": { "enum": [ null ] }
+ }
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "string props valid",
+ "data": { "bar": "foo", "bob": "who?" },
+ "valid": true
+ },
+ {
+ "description": "null prop is invalid",
+ "data": { "bar": "foo", "bob": null },
+ "valid": false
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft4/oneOf.json b/json/tests/draft4/oneOf.json
index 9dfffe1..bdb2519 100644
--- a/json/tests/draft4/oneOf.json
+++ b/json/tests/draft4/oneOf.json
@@ -158,5 +158,47 @@
"valid": false
}
]
+ },
+ {
+ "description": "oneOf with missing optional property",
+ "schema": {
+ "oneOf": [
+ {
+ "properties": {
+ "bar": {},
+ "baz": {}
+ },
+ "required": ["bar"]
+ },
+ {
+ "properties": {
+ "foo": {}
+ },
+ "required": ["foo"]
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "first oneOf valid",
+ "data": {"bar": 8},
+ "valid": true
+ },
+ {
+ "description": "second oneOf valid",
+ "data": {"foo": "foo"},
+ "valid": true
+ },
+ {
+ "description": "both oneOf valid",
+ "data": {"foo": "foo", "bar": 8},
+ "valid": false
+ },
+ {
+ "description": "neither oneOf valid",
+ "data": {"baz": "quux"},
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft4/optional/ecmascript-regex.json b/json/tests/draft4/optional/ecmascript-regex.json
index d82e0fe..106c33b 100644
--- a/json/tests/draft4/optional/ecmascript-regex.json
+++ b/json/tests/draft4/optional/ecmascript-regex.json
@@ -30,20 +30,20 @@
]
},
{
- "description": "ECMA 262 regex converts \\a to ascii BEL",
+ "description": "ECMA 262 regex converts \\t to horizontal tab",
"schema": {
"type": "string",
- "pattern": "^\\a$"
+ "pattern": "^\\t$"
},
"tests": [
{
"description": "does not match",
- "data": "\\a",
+ "data": "\\t",
"valid": false
},
{
"description": "matches",
- "data": "\u0007",
+ "data": "\u0009",
"valid": true
}
]
diff --git a/json/tests/draft6/oneOf.json b/json/tests/draft6/oneOf.json
index 57640b7..76ca96c 100644
--- a/json/tests/draft6/oneOf.json
+++ b/json/tests/draft6/oneOf.json
@@ -202,5 +202,47 @@
"valid": false
}
]
+ },
+ {
+ "description": "oneOf with missing optional property",
+ "schema": {
+ "oneOf": [
+ {
+ "properties": {
+ "bar": true,
+ "baz": true
+ },
+ "required": ["bar"]
+ },
+ {
+ "properties": {
+ "foo": true
+ },
+ "required": ["foo"]
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "first oneOf valid",
+ "data": {"bar": 8},
+ "valid": true
+ },
+ {
+ "description": "second oneOf valid",
+ "data": {"foo": "foo"},
+ "valid": true
+ },
+ {
+ "description": "both oneOf valid",
+ "data": {"foo": "foo", "bar": 8},
+ "valid": false
+ },
+ {
+ "description": "neither oneOf valid",
+ "data": {"baz": "quux"},
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft6/optional/ecmascript-regex.json b/json/tests/draft6/optional/ecmascript-regex.json
index d82e0fe..106c33b 100644
--- a/json/tests/draft6/optional/ecmascript-regex.json
+++ b/json/tests/draft6/optional/ecmascript-regex.json
@@ -30,20 +30,20 @@
]
},
{
- "description": "ECMA 262 regex converts \\a to ascii BEL",
+ "description": "ECMA 262 regex converts \\t to horizontal tab",
"schema": {
"type": "string",
- "pattern": "^\\a$"
+ "pattern": "^\\t$"
},
"tests": [
{
"description": "does not match",
- "data": "\\a",
+ "data": "\\t",
"valid": false
},
{
"description": "matches",
- "data": "\u0007",
+ "data": "\u0009",
"valid": true
}
]
diff --git a/json/tests/draft7/oneOf.json b/json/tests/draft7/oneOf.json
index 57640b7..76ca96c 100644
--- a/json/tests/draft7/oneOf.json
+++ b/json/tests/draft7/oneOf.json
@@ -202,5 +202,47 @@
"valid": false
}
]
+ },
+ {
+ "description": "oneOf with missing optional property",
+ "schema": {
+ "oneOf": [
+ {
+ "properties": {
+ "bar": true,
+ "baz": true
+ },
+ "required": ["bar"]
+ },
+ {
+ "properties": {
+ "foo": true
+ },
+ "required": ["foo"]
+ }
+ ]
+ },
+ "tests": [
+ {
+ "description": "first oneOf valid",
+ "data": {"bar": 8},
+ "valid": true
+ },
+ {
+ "description": "second oneOf valid",
+ "data": {"foo": "foo"},
+ "valid": true
+ },
+ {
+ "description": "both oneOf valid",
+ "data": {"foo": "foo", "bar": 8},
+ "valid": false
+ },
+ {
+ "description": "neither oneOf valid",
+ "data": {"baz": "quux"},
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft7/optional/ecmascript-regex.json b/json/tests/draft7/optional/ecmascript-regex.json
index d82e0fe..106c33b 100644
--- a/json/tests/draft7/optional/ecmascript-regex.json
+++ b/json/tests/draft7/optional/ecmascript-regex.json
@@ -30,20 +30,20 @@
]
},
{
- "description": "ECMA 262 regex converts \\a to ascii BEL",
+ "description": "ECMA 262 regex converts \\t to horizontal tab",
"schema": {
"type": "string",
- "pattern": "^\\a$"
+ "pattern": "^\\t$"
},
"tests": [
{
"description": "does not match",
- "data": "\\a",
+ "data": "\\t",
"valid": false
},
{
"description": "matches",
- "data": "\u0007",
+ "data": "\u0009",
"valid": true
}
]