summaryrefslogtreecommitdiff
path: root/json/tests/draft4
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2021-04-28 09:33:03 -0400
committerJulian Berman <Julian@GrayVines.com>2021-04-28 09:33:03 -0400
commit783d81d5ef41ddda7681bd63f6fb7ce05ef3d8d8 (patch)
treecc4bd5ff399308db833c6d74721ebc9bb761e89f /json/tests/draft4
parenta241799a5a5ffafaa93d6dd9b9cd8762e02525c6 (diff)
parentc19f0b4ee66ce10217185fa8d2c8b7a2784e3a31 (diff)
downloadjsonschema-783d81d5ef41ddda7681bd63f6fb7ce05ef3d8d8.tar.gz
Merge commit 'c19f0b4ee66ce10217185fa8d2c8b7a2784e3a31'
* commit 'c19f0b4ee66ce10217185fa8d2c8b7a2784e3a31': Squashed 'json/' changes from 15ec577f..09fd353f
Diffstat (limited to 'json/tests/draft4')
-rw-r--r--json/tests/draft4/additionalItems.json23
-rw-r--r--json/tests/draft4/default.json30
-rw-r--r--json/tests/draft4/ref.json2
3 files changed, 52 insertions, 3 deletions
diff --git a/json/tests/draft4/additionalItems.json b/json/tests/draft4/additionalItems.json
index ee46b61..784bc84 100644
--- a/json/tests/draft4/additionalItems.json
+++ b/json/tests/draft4/additionalItems.json
@@ -19,7 +19,7 @@
]
},
{
- "description": "items is schema, no additionalItems",
+ "description": "when items is schema, additionalItems does nothing",
"schema": {
"items": {},
"additionalItems": false
@@ -33,7 +33,7 @@
]
},
{
- "description": "array of items with no additionalItems",
+ "description": "array of items with no additionalItems permitted",
"schema": {
"items": [{}, {}, {}],
"additionalItems": false
@@ -126,5 +126,24 @@
"valid": false
}
]
+ },
+ {
+ "description": "items validation adjusts the starting index for additionalItems",
+ "schema": {
+ "items": [ { "type": "string" } ],
+ "additionalItems": { "type": "integer" }
+ },
+ "tests": [
+ {
+ "description": "valid items",
+ "data": [ "x", 2, 3 ],
+ "valid": true
+ },
+ {
+ "description": "wrong type of second item",
+ "data": [ "x", "y" ],
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft4/default.json b/json/tests/draft4/default.json
index 1762977..289a9b6 100644
--- a/json/tests/draft4/default.json
+++ b/json/tests/draft4/default.json
@@ -45,5 +45,35 @@
"valid": true
}
]
+ },
+ {
+ "description": "the default keyword does not do anything if the property is missing",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "alpha": {
+ "type": "number",
+ "maximum": 3,
+ "default": 5
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "an explicit property value is checked against maximum (passing)",
+ "data": { "alpha": 1 },
+ "valid": true
+ },
+ {
+ "description": "an explicit property value is checked against maximum (failing)",
+ "data": { "alpha": 5 },
+ "valid": false
+ },
+ {
+ "description": "missing properties are not filled in with the default",
+ "data": {},
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft4/ref.json b/json/tests/draft4/ref.json
index 33f7441..48544ba 100644
--- a/json/tests/draft4/ref.json
+++ b/json/tests/draft4/ref.json
@@ -447,7 +447,7 @@
},
"tests": [
{
- "description": "do not evaluate the $ref inside the enum",
+ "description": "do not evaluate the $ref inside the enum, matching any string",
"data": "this is a string",
"valid": false
},