summaryrefslogtreecommitdiff
path: root/json
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2020-10-04 11:58:30 -0400
committerJulian Berman <Julian@GrayVines.com>2020-10-04 11:58:30 -0400
commit78d869421b2bf096251bc89ee908ed0cbff62952 (patch)
tree3dd210b6a1cb015ee6221a9597f4b2c3d0ede734 /json
parentddcc2e23dfd1cd5c5e60403bca32b36bf2c2f50c (diff)
parent918803aa556f4f87d6b952af316d47ecaf089164 (diff)
downloadjsonschema-78d869421b2bf096251bc89ee908ed0cbff62952.tar.gz
Merge commit '918803aa556f4f87d6b952af316d47ecaf089164' into master
* commit '918803aa556f4f87d6b952af316d47ecaf089164': Squashed 'json/' changes from 21555a85..96742ba3
Diffstat (limited to 'json')
-rw-r--r--json/tests/draft2019-09/if-then-else.json30
-rw-r--r--json/tests/draft2019-09/multipleOf.json11
-rw-r--r--json/tests/draft2019-09/optional/float-overflow.json13
-rw-r--r--json/tests/draft2019-09/unevaluatedItems.json30
-rw-r--r--json/tests/draft4/multipleOf.json11
-rw-r--r--json/tests/draft4/optional/float-overflow.json13
-rw-r--r--json/tests/draft6/multipleOf.json11
-rw-r--r--json/tests/draft6/optional/float-overflow.json13
-rw-r--r--json/tests/draft7/if-then-else.json30
-rw-r--r--json/tests/draft7/multipleOf.json11
-rw-r--r--json/tests/draft7/optional/float-overflow.json13
11 files changed, 171 insertions, 15 deletions
diff --git a/json/tests/draft2019-09/if-then-else.json b/json/tests/draft2019-09/if-then-else.json
index e0b873e..284e919 100644
--- a/json/tests/draft2019-09/if-then-else.json
+++ b/json/tests/draft2019-09/if-then-else.json
@@ -224,5 +224,35 @@
"valid": true
}
]
+ },
+ {
+ "description": "if appears at the end when serialized (keyword processing sequence)",
+ "schema": {
+ "then": { "const": "yes" },
+ "else": { "const": "other" },
+ "if": { "maxLength": 4 }
+ },
+ "tests": [
+ {
+ "description": "yes redirects to then and passes",
+ "data": "yes",
+ "valid": true
+ },
+ {
+ "description": "other redirects to else and passes",
+ "data": "other",
+ "valid": true
+ },
+ {
+ "description": "no redirects to then and fails",
+ "data": "no",
+ "valid": false
+ },
+ {
+ "description": "invalid redirects to else and fails",
+ "data": "invalid",
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft2019-09/multipleOf.json b/json/tests/draft2019-09/multipleOf.json
index ca3b761..faa87cf 100644
--- a/json/tests/draft2019-09/multipleOf.json
+++ b/json/tests/draft2019-09/multipleOf.json
@@ -56,5 +56,16 @@
"valid": false
}
]
+ },
+ {
+ "description": "invalid instance should not raise error when float division = inf",
+ "schema": {"type": "integer", "multipleOf": 0.123456789},
+ "tests": [
+ {
+ "description": "always invalid, but naive implementations may raise an overflow error",
+ "data": 1e308,
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft2019-09/optional/float-overflow.json b/json/tests/draft2019-09/optional/float-overflow.json
new file mode 100644
index 0000000..52ff982
--- /dev/null
+++ b/json/tests/draft2019-09/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/draft2019-09/unevaluatedItems.json b/json/tests/draft2019-09/unevaluatedItems.json
index 01c07be..32f13f8 100644
--- a/json/tests/draft2019-09/unevaluatedItems.json
+++ b/json/tests/draft2019-09/unevaluatedItems.json
@@ -87,12 +87,12 @@
},
"tests": [
{
- "description": "with no unevaluted items",
+ "description": "with no unevaluated items",
"data": ["foo"],
"valid": true
},
{
- "description": "with unevaluted items",
+ "description": "with unevaluated items",
"data": ["foo", "bar"],
"valid": false
}
@@ -135,12 +135,12 @@
},
"tests": [
{
- "description": "with no unevaluted items",
+ "description": "with no unevaluated items",
"data": ["foo", 42],
"valid": true
},
{
- "description": "with unevaluted items",
+ "description": "with unevaluated items",
"data": ["foo", 42, true],
"valid": false
}
@@ -228,22 +228,22 @@
},
"tests": [
{
- "description": "when one schema matches and has no unevaluted items",
+ "description": "when one schema matches and has no unevaluated items",
"data": ["foo", "bar"],
"valid": true
},
{
- "description": "when one schema matches and has unevaluted items",
+ "description": "when one schema matches and has unevaluated items",
"data": ["foo", "bar", 42],
"valid": false
},
{
- "description": "when two schemas match and has no unevaluted items",
+ "description": "when two schemas match and has no unevaluated items",
"data": ["foo", "bar", "baz"],
"valid": true
},
{
- "description": "when two schemas match and has unevaluted items",
+ "description": "when two schemas match and has unevaluated items",
"data": ["foo", "bar", "baz", 42],
"valid": false
}
@@ -274,12 +274,12 @@
},
"tests": [
{
- "description": "with no unevaluted items",
+ "description": "with no unevaluated items",
"data": ["foo", "bar"],
"valid": true
},
{
- "description": "with unevaluted items",
+ "description": "with unevaluated items",
"data": ["foo", "bar", 42],
"valid": false
}
@@ -304,7 +304,7 @@
},
"tests": [
{
- "description": "with unevaluted items",
+ "description": "with unevaluated items",
"data": ["foo", "bar"],
"valid": false
}
@@ -342,22 +342,22 @@
},
"tests": [
{
- "description": "when if matches and it has no unevaluted items",
+ "description": "when if matches and it has no unevaluated items",
"data": ["foo", "bar", "then"],
"valid": true
},
{
- "description": "when if matches and it has unevaluted items",
+ "description": "when if matches and it has unevaluated items",
"data": ["foo", "bar", "then", "else"],
"valid": false
},
{
- "description": "when if doesn't match and it has no unevaluted items",
+ "description": "when if doesn't match and it has no unevaluated items",
"data": ["foo", 42, 42, "else"],
"valid": true
},
{
- "description": "when if doesn't match and it has unevaluted items",
+ "description": "when if doesn't match and it has unevaluated items",
"data": ["foo", 42, 42, "else", 42],
"valid": false
}
diff --git a/json/tests/draft4/multipleOf.json b/json/tests/draft4/multipleOf.json
index ca3b761..faa87cf 100644
--- a/json/tests/draft4/multipleOf.json
+++ b/json/tests/draft4/multipleOf.json
@@ -56,5 +56,16 @@
"valid": false
}
]
+ },
+ {
+ "description": "invalid instance should not raise error when float division = inf",
+ "schema": {"type": "integer", "multipleOf": 0.123456789},
+ "tests": [
+ {
+ "description": "always invalid, but naive implementations may raise an overflow error",
+ "data": 1e308,
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft4/optional/float-overflow.json b/json/tests/draft4/optional/float-overflow.json
new file mode 100644
index 0000000..52ff982
--- /dev/null
+++ b/json/tests/draft4/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/draft6/multipleOf.json b/json/tests/draft6/multipleOf.json
index ca3b761..faa87cf 100644
--- a/json/tests/draft6/multipleOf.json
+++ b/json/tests/draft6/multipleOf.json
@@ -56,5 +56,16 @@
"valid": false
}
]
+ },
+ {
+ "description": "invalid instance should not raise error when float division = inf",
+ "schema": {"type": "integer", "multipleOf": 0.123456789},
+ "tests": [
+ {
+ "description": "always invalid, but naive implementations may raise an overflow error",
+ "data": 1e308,
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft6/optional/float-overflow.json b/json/tests/draft6/optional/float-overflow.json
new file mode 100644
index 0000000..52ff982
--- /dev/null
+++ b/json/tests/draft6/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/draft7/if-then-else.json b/json/tests/draft7/if-then-else.json
index e0b873e..284e919 100644
--- a/json/tests/draft7/if-then-else.json
+++ b/json/tests/draft7/if-then-else.json
@@ -224,5 +224,35 @@
"valid": true
}
]
+ },
+ {
+ "description": "if appears at the end when serialized (keyword processing sequence)",
+ "schema": {
+ "then": { "const": "yes" },
+ "else": { "const": "other" },
+ "if": { "maxLength": 4 }
+ },
+ "tests": [
+ {
+ "description": "yes redirects to then and passes",
+ "data": "yes",
+ "valid": true
+ },
+ {
+ "description": "other redirects to else and passes",
+ "data": "other",
+ "valid": true
+ },
+ {
+ "description": "no redirects to then and fails",
+ "data": "no",
+ "valid": false
+ },
+ {
+ "description": "invalid redirects to else and fails",
+ "data": "invalid",
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft7/multipleOf.json b/json/tests/draft7/multipleOf.json
index ca3b761..faa87cf 100644
--- a/json/tests/draft7/multipleOf.json
+++ b/json/tests/draft7/multipleOf.json
@@ -56,5 +56,16 @@
"valid": false
}
]
+ },
+ {
+ "description": "invalid instance should not raise error when float division = inf",
+ "schema": {"type": "integer", "multipleOf": 0.123456789},
+ "tests": [
+ {
+ "description": "always invalid, but naive implementations may raise an overflow error",
+ "data": 1e308,
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft7/optional/float-overflow.json b/json/tests/draft7/optional/float-overflow.json
new file mode 100644
index 0000000..52ff982
--- /dev/null
+++ b/json/tests/draft7/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
+ }
+ ]
+ }
+]