summaryrefslogtreecommitdiff
path: root/json
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2020-02-22 17:12:34 -0500
committerJulian Berman <Julian@GrayVines.com>2020-02-22 17:12:34 -0500
commit1fc76078f5f20ffd09e365a23925ecfbe826908e (patch)
tree93fb3fc28ac240edad5253bbefc9c8a8c1225301 /json
parent0d192e192526252c30c16b3651c293bb5f21a99f (diff)
parentf7930d774c893cfae814a214d9b2ba0c01957928 (diff)
downloadjsonschema-1fc76078f5f20ffd09e365a23925ecfbe826908e.tar.gz
Merge commit 'f7930d774c893cfae814a214d9b2ba0c01957928'
* commit 'f7930d774c893cfae814a214d9b2ba0c01957928': Squashed 'json/' changes from a863dbab..d52866b3
Diffstat (limited to 'json')
-rwxr-xr-xjson/bin/jsonschema_suite11
-rw-r--r--json/tests/draft2019-09/const.json57
-rw-r--r--json/tests/draft2019-09/dependencies.json58
-rw-r--r--json/tests/draft2019-09/enum.json10
-rw-r--r--json/tests/draft2019-09/maximum.json26
-rw-r--r--json/tests/draft2019-09/minimum.json12
-rw-r--r--json/tests/draft2019-09/optional/refOfUnknownKeyword.json44
-rw-r--r--json/tests/draft2019-09/ref.json10
-rw-r--r--json/tests/draft3/dependencies.json5
-rw-r--r--json/tests/draft3/enum.json10
-rw-r--r--json/tests/draft3/maximum.json57
-rw-r--r--json/tests/draft3/minimum.json17
-rw-r--r--json/tests/draft4/enum.json10
-rw-r--r--json/tests/draft4/maximum.json26
-rw-r--r--json/tests/draft4/minimum.json12
-rw-r--r--json/tests/draft6/const.json57
-rw-r--r--json/tests/draft6/dependencies.json30
-rw-r--r--json/tests/draft6/enum.json10
-rw-r--r--json/tests/draft6/maximum.json26
-rw-r--r--json/tests/draft6/minimum.json12
-rw-r--r--json/tests/draft7/const.json57
-rw-r--r--json/tests/draft7/dependencies.json30
-rw-r--r--json/tests/draft7/enum.json10
-rw-r--r--json/tests/draft7/maximum.json26
-rw-r--r--json/tests/draft7/minimum.json12
-rw-r--r--json/tox.ini2
26 files changed, 531 insertions, 106 deletions
diff --git a/json/bin/jsonschema_suite b/json/bin/jsonschema_suite
index 6b1c486..36bb2dd 100755
--- a/json/bin/jsonschema_suite
+++ b/json/bin/jsonschema_suite
@@ -17,13 +17,9 @@ if getattr(unittest, "skipIf", None) is None:
unittest.skipIf = lambda cond, msg : lambda fn : fn
try:
- import jsonschema
+ import jsonschema.validators
except ImportError:
jsonschema = None
-else:
- validators = getattr(
- jsonschema.validators, "validators", jsonschema.validators
- )
ROOT_DIR = os.path.abspath(
@@ -120,7 +116,7 @@ class SanityTests(unittest.TestCase):
@unittest.skipIf(jsonschema is None, "Validation library not present!")
def test_all_schemas_are_valid(self):
for schema in os.listdir(SUITE_ROOT_DIR):
- schema_validator = validators.get(schema)
+ schema_validator = jsonschema.validators.validators.get(schema)
if schema_validator is not None:
test_files = collect(os.path.join(SUITE_ROOT_DIR, schema))
for case in cases(test_files):
@@ -134,7 +130,8 @@ class SanityTests(unittest.TestCase):
@unittest.skipIf(jsonschema is None, "Validation library not present!")
def test_suites_are_valid(self):
- validator = jsonschema.Draft4Validator(TESTSUITE_SCHEMA)
+ Validator = jsonschema.validators.validator_for(TESTSUITE_SCHEMA)
+ validator = Validator(TESTSUITE_SCHEMA)
for tests in files(self.test_files):
try:
validator.validate(tests)
diff --git a/json/tests/draft2019-09/const.json b/json/tests/draft2019-09/const.json
index c741f60..1a55235 100644
--- a/json/tests/draft2019-09/const.json
+++ b/json/tests/draft2019-09/const.json
@@ -181,5 +181,62 @@
"valid": true
}
]
+ },
+ {
+ "description": "const with -2.0 matches integer and float types",
+ "schema": {"const": -2.0},
+ "tests": [
+ {
+ "description": "integer -2 is valid",
+ "data": -2,
+ "valid": true
+ },
+ {
+ "description": "integer 2 is invalid",
+ "data": 2,
+ "valid": false
+ },
+ {
+ "description": "float -2.0 is valid",
+ "data": -2.0,
+ "valid": true
+ },
+ {
+ "description": "float 2.0 is invalid",
+ "data": 2.0,
+ "valid": false
+ },
+ {
+ "description": "float -2.00001 is invalid",
+ "data": -2.00001,
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "float and integers are equal up to 64-bit representation limits",
+ "schema": {"const": 9007199254740992},
+ "tests": [
+ {
+ "description": "integer is valid",
+ "data": 9007199254740992,
+ "valid": true
+ },
+ {
+ "description": "integer minus one is invalid",
+ "data": 9007199254740991,
+ "valid": false
+ },
+ {
+ "description": "float is valid",
+ "data": 9007199254740992.0,
+ "valid": true
+ },
+ {
+ "description": "float minus one is invalid",
+ "data": 9007199254740991.0,
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft2019-09/dependencies.json b/json/tests/draft2019-09/dependencies.json
index 8dd78aa..b82b5a9 100644
--- a/json/tests/draft2019-09/dependencies.json
+++ b/json/tests/draft2019-09/dependencies.json
@@ -1,8 +1,8 @@
[
{
- "description": "dependencies",
+ "description": "dependentRequired",
"schema": {
- "dependencies": {"bar": ["foo"]}
+ "dependentRequired": {"bar": ["foo"]}
},
"tests": [
{
@@ -43,9 +43,9 @@
]
},
{
- "description": "dependencies with empty array",
+ "description": "dependentRequired with empty array",
"schema": {
- "dependencies": {"bar": []}
+ "dependentRequired": {"bar": []}
},
"tests": [
{
@@ -57,13 +57,18 @@
"description": "object with one property",
"data": {"bar": 2},
"valid": true
+ },
+ {
+ "description": "non-object is valid",
+ "data": 1,
+ "valid": true
}
]
},
{
- "description": "multiple dependencies",
+ "description": "multiple dependents required",
"schema": {
- "dependencies": {"quux": ["foo", "bar"]}
+ "dependentRequired": {"quux": ["foo", "bar"]}
},
"tests": [
{
@@ -99,9 +104,9 @@
]
},
{
- "description": "multiple dependencies subschema",
+ "description": "multiple dependentSchemas subschema",
"schema": {
- "dependencies": {
+ "dependentSchemas": {
"bar": {
"properties": {
"foo": {"type": "integer"},
@@ -139,9 +144,9 @@
]
},
{
- "description": "dependencies with boolean subschemas",
+ "description": "dependentSchemas with boolean subschemas",
"schema": {
- "dependencies": {
+ "dependentSchemas": {
"foo": true,
"bar": false
}
@@ -170,40 +175,17 @@
]
},
{
- "description": "empty array of dependencies",
- "schema": {
- "dependencies": {
- "foo": []
- }
- },
- "tests": [
- {
- "description": "object with property is valid",
- "data": { "foo": 1 },
- "valid": true
- },
- {
- "description": "empty object is valid",
- "data": {},
- "valid": true
- },
- {
- "description": "non-object is valid",
- "data": 1,
- "valid": true
- }
- ]
- },
- {
"description": "dependencies with escaped characters",
"schema": {
- "dependencies": {
+ "dependentRequired": {
"foo\nbar": ["foo\rbar"],
+ "foo\"bar": ["foo'bar"]
+ },
+ "dependentSchemas": {
"foo\tbar": {
"minProperties": 4
},
- "foo'bar": {"required": ["foo\"bar"]},
- "foo\"bar": ["foo'bar"]
+ "foo'bar": {"required": ["foo\"bar"]}
}
},
"tests": [
diff --git a/json/tests/draft2019-09/enum.json b/json/tests/draft2019-09/enum.json
index 32d7902..9327a70 100644
--- a/json/tests/draft2019-09/enum.json
+++ b/json/tests/draft2019-09/enum.json
@@ -53,6 +53,16 @@
"valid": true
},
{
+ "description": "wrong foo value",
+ "data": {"foo":"foot", "bar":"bar"},
+ "valid": false
+ },
+ {
+ "description": "wrong bar value",
+ "data": {"foo":"foo", "bar":"bart"},
+ "valid": false
+ },
+ {
"description": "missing optional property is valid",
"data": {"bar":"bar"},
"valid": true
diff --git a/json/tests/draft2019-09/maximum.json b/json/tests/draft2019-09/maximum.json
index 8150984..6844a39 100644
--- a/json/tests/draft2019-09/maximum.json
+++ b/json/tests/draft2019-09/maximum.json
@@ -24,5 +24,31 @@
"valid": true
}
]
+ },
+ {
+ "description": "maximum validation with unsigned integer",
+ "schema": {"maximum": 300},
+ "tests": [
+ {
+ "description": "below the maximum is invalid",
+ "data": 299.97,
+ "valid": true
+ },
+ {
+ "description": "boundary point integer is valid",
+ "data": 300,
+ "valid": true
+ },
+ {
+ "description": "boundary point float is valid",
+ "data": 300.00,
+ "valid": true
+ },
+ {
+ "description": "above the maximum is invalid",
+ "data": 300.5,
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft2019-09/minimum.json b/json/tests/draft2019-09/minimum.json
index 2a9c42b..21ae50e 100644
--- a/json/tests/draft2019-09/minimum.json
+++ b/json/tests/draft2019-09/minimum.json
@@ -45,7 +45,17 @@
"valid": true
},
{
- "description": "below the minimum is invalid",
+ "description": "boundary point with float is valid",
+ "data": -2.0,
+ "valid": true
+ },
+ {
+ "description": "float below the minimum is invalid",
+ "data": -2.0001,
+ "valid": false
+ },
+ {
+ "description": "int below the minimum is invalid",
"data": -3,
"valid": false
},
diff --git a/json/tests/draft2019-09/optional/refOfUnknownKeyword.json b/json/tests/draft2019-09/optional/refOfUnknownKeyword.json
new file mode 100644
index 0000000..5b150df
--- /dev/null
+++ b/json/tests/draft2019-09/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
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft2019-09/ref.json b/json/tests/draft2019-09/ref.json
index 285de55..2fc7702 100644
--- a/json/tests/draft2019-09/ref.json
+++ b/json/tests/draft2019-09/ref.json
@@ -141,7 +141,7 @@
]
},
{
- "description": "ref overrides any sibling keywords",
+ "description": "ref applies alongside sibling keywords",
"schema": {
"$defs": {
"reffed": {
@@ -157,14 +157,14 @@
},
"tests": [
{
- "description": "ref valid",
+ "description": "ref valid, maxItems valid",
"data": { "foo": [] },
"valid": true
},
{
- "description": "ref valid, maxItems ignored",
- "data": { "foo": [ 1, 2, 3] },
- "valid": true
+ "description": "ref valid, maxItems invalid",
+ "data": { "foo": [1, 2, 3] },
+ "valid": false
},
{
"description": "ref invalid",
diff --git a/json/tests/draft3/dependencies.json b/json/tests/draft3/dependencies.json
index d7e0925..0ffa6bf 100644
--- a/json/tests/draft3/dependencies.json
+++ b/json/tests/draft3/dependencies.json
@@ -99,6 +99,11 @@
"valid": true
},
{
+ "description": "no dependency",
+ "data": {"foo": "quux"},
+ "valid": true
+ },
+ {
"description": "wrong type",
"data": {"foo": "quux", "bar": 2},
"valid": false
diff --git a/json/tests/draft3/enum.json b/json/tests/draft3/enum.json
index fc3e070..6cb2961 100644
--- a/json/tests/draft3/enum.json
+++ b/json/tests/draft3/enum.json
@@ -52,6 +52,16 @@
"valid": true
},
{
+ "description": "wrong foo value",
+ "data": {"foo":"foot", "bar":"bar"},
+ "valid": false
+ },
+ {
+ "description": "wrong bar value",
+ "data": {"foo":"foo", "bar":"bart"},
+ "valid": false
+ },
+ {
"description": "missing optional property is valid",
"data": {"bar":"bar"},
"valid": true
diff --git a/json/tests/draft3/maximum.json b/json/tests/draft3/maximum.json
index 86c7b89..ccb79c6 100644
--- a/json/tests/draft3/maximum.json
+++ b/json/tests/draft3/maximum.json
@@ -9,6 +9,63 @@
"valid": true
},
{
+ "description": "boundary point is valid",
+ "data": 3.0,
+ "valid": true
+ },
+ {
+ "description": "above the maximum is invalid",
+ "data": 3.5,
+ "valid": false
+ },
+ {
+ "description": "ignores non-numbers",
+ "data": "x",
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "maximum validation with unsigned integer",
+ "schema": {"maximum": 300},
+ "tests": [
+ {
+ "description": "below the maximum is invalid",
+ "data": 299.97,
+ "valid": true
+ },
+ {
+ "description": "boundary point integer is valid",
+ "data": 300,
+ "valid": true
+ },
+ {
+ "description": "boundary point float is valid",
+ "data": 300.00,
+ "valid": true
+ },
+ {
+ "description": "above the maximum is invalid",
+ "data": 300.5,
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "maximum validation (explicit false exclusivity)",
+ "schema": {"maximum": 3.0, "exclusiveMaximum": false},
+ "tests": [
+ {
+ "description": "below the maximum is valid",
+ "data": 2.6,
+ "valid": true
+ },
+ {
+ "description": "boundary point is valid",
+ "data": 3.0,
+ "valid": true
+ },
+ {
"description": "above the maximum is invalid",
"data": 3.5,
"valid": false
diff --git a/json/tests/draft3/minimum.json b/json/tests/draft3/minimum.json
index 5ac9fee..d579536 100644
--- a/json/tests/draft3/minimum.json
+++ b/json/tests/draft3/minimum.json
@@ -9,6 +9,11 @@
"valid": true
},
{
+ "description": "boundary point is valid",
+ "data": 1.1,
+ "valid": true
+ },
+ {
"description": "below the minimum is invalid",
"data": 0.6,
"valid": false
@@ -59,7 +64,17 @@
"valid": true
},
{
- "description": "below the minimum is invalid",
+ "description": "boundary point with float is valid",
+ "data": -2.0,
+ "valid": true
+ },
+ {
+ "description": "float below the minimum is invalid",
+ "data": -2.0001,
+ "valid": false
+ },
+ {
+ "description": "int below the minimum is invalid",
"data": -3,
"valid": false
},
diff --git a/json/tests/draft4/enum.json b/json/tests/draft4/enum.json
index 32d7902..9327a70 100644
--- a/json/tests/draft4/enum.json
+++ b/json/tests/draft4/enum.json
@@ -53,6 +53,16 @@
"valid": true
},
{
+ "description": "wrong foo value",
+ "data": {"foo":"foot", "bar":"bar"},
+ "valid": false
+ },
+ {
+ "description": "wrong bar value",
+ "data": {"foo":"foo", "bar":"bart"},
+ "valid": false
+ },
+ {
"description": "missing optional property is valid",
"data": {"bar":"bar"},
"valid": true
diff --git a/json/tests/draft4/maximum.json b/json/tests/draft4/maximum.json
index 02581f6..ccb79c6 100644
--- a/json/tests/draft4/maximum.json
+++ b/json/tests/draft4/maximum.json
@@ -26,6 +26,32 @@
]
},
{
+ "description": "maximum validation with unsigned integer",
+ "schema": {"maximum": 300},
+ "tests": [
+ {
+ "description": "below the maximum is invalid",
+ "data": 299.97,
+ "valid": true
+ },
+ {
+ "description": "boundary point integer is valid",
+ "data": 300,
+ "valid": true
+ },
+ {
+ "description": "boundary point float is valid",
+ "data": 300.00,
+ "valid": true
+ },
+ {
+ "description": "above the maximum is invalid",
+ "data": 300.5,
+ "valid": false
+ }
+ ]
+ },
+ {
"description": "maximum validation (explicit false exclusivity)",
"schema": {"maximum": 3.0, "exclusiveMaximum": false},
"tests": [
diff --git a/json/tests/draft4/minimum.json b/json/tests/draft4/minimum.json
index 6becf2a..22d310e 100644
--- a/json/tests/draft4/minimum.json
+++ b/json/tests/draft4/minimum.json
@@ -90,7 +90,17 @@
"valid": true
},
{
- "description": "below the minimum is invalid",
+ "description": "boundary point with float is valid",
+ "data": -2.0,
+ "valid": true
+ },
+ {
+ "description": "float below the minimum is invalid",
+ "data": -2.0001,
+ "valid": false
+ },
+ {
+ "description": "int below the minimum is invalid",
"data": -3,
"valid": false
},
diff --git a/json/tests/draft6/const.json b/json/tests/draft6/const.json
index c741f60..1a55235 100644
--- a/json/tests/draft6/const.json
+++ b/json/tests/draft6/const.json
@@ -181,5 +181,62 @@
"valid": true
}
]
+ },
+ {
+ "description": "const with -2.0 matches integer and float types",
+ "schema": {"const": -2.0},
+ "tests": [
+ {
+ "description": "integer -2 is valid",
+ "data": -2,
+ "valid": true
+ },
+ {
+ "description": "integer 2 is invalid",
+ "data": 2,
+ "valid": false
+ },
+ {
+ "description": "float -2.0 is valid",
+ "data": -2.0,
+ "valid": true
+ },
+ {
+ "description": "float 2.0 is invalid",
+ "data": 2.0,
+ "valid": false
+ },
+ {
+ "description": "float -2.00001 is invalid",
+ "data": -2.00001,
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "float and integers are equal up to 64-bit representation limits",
+ "schema": {"const": 9007199254740992},
+ "tests": [
+ {
+ "description": "integer is valid",
+ "data": 9007199254740992,
+ "valid": true
+ },
+ {
+ "description": "integer minus one is invalid",
+ "data": 9007199254740991,
+ "valid": false
+ },
+ {
+ "description": "float is valid",
+ "data": 9007199254740992.0,
+ "valid": true
+ },
+ {
+ "description": "float minus one is invalid",
+ "data": 9007199254740991.0,
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft6/dependencies.json b/json/tests/draft6/dependencies.json
index 8dd78aa..a5e5428 100644
--- a/json/tests/draft6/dependencies.json
+++ b/json/tests/draft6/dependencies.json
@@ -57,6 +57,11 @@
"description": "object with one property",
"data": {"bar": 2},
"valid": true
+ },
+ {
+ "description": "non-object is valid",
+ "data": 1,
+ "valid": true
}
]
},
@@ -170,31 +175,6 @@
]
},
{
- "description": "empty array of dependencies",
- "schema": {
- "dependencies": {
- "foo": []
- }
- },
- "tests": [
- {
- "description": "object with property is valid",
- "data": { "foo": 1 },
- "valid": true
- },
- {
- "description": "empty object is valid",
- "data": {},
- "valid": true
- },
- {
- "description": "non-object is valid",
- "data": 1,
- "valid": true
- }
- ]
- },
- {
"description": "dependencies with escaped characters",
"schema": {
"dependencies": {
diff --git a/json/tests/draft6/enum.json b/json/tests/draft6/enum.json
index 32d7902..9327a70 100644
--- a/json/tests/draft6/enum.json
+++ b/json/tests/draft6/enum.json
@@ -53,6 +53,16 @@
"valid": true
},
{
+ "description": "wrong foo value",
+ "data": {"foo":"foot", "bar":"bar"},
+ "valid": false
+ },
+ {
+ "description": "wrong bar value",
+ "data": {"foo":"foo", "bar":"bart"},
+ "valid": false
+ },
+ {
"description": "missing optional property is valid",
"data": {"bar":"bar"},
"valid": true
diff --git a/json/tests/draft6/maximum.json b/json/tests/draft6/maximum.json
index 8150984..6844a39 100644
--- a/json/tests/draft6/maximum.json
+++ b/json/tests/draft6/maximum.json
@@ -24,5 +24,31 @@
"valid": true
}
]
+ },
+ {
+ "description": "maximum validation with unsigned integer",
+ "schema": {"maximum": 300},
+ "tests": [
+ {
+ "description": "below the maximum is invalid",
+ "data": 299.97,
+ "valid": true
+ },
+ {
+ "description": "boundary point integer is valid",
+ "data": 300,
+ "valid": true
+ },
+ {
+ "description": "boundary point float is valid",
+ "data": 300.00,
+ "valid": true
+ },
+ {
+ "description": "above the maximum is invalid",
+ "data": 300.5,
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft6/minimum.json b/json/tests/draft6/minimum.json
index 2a9c42b..21ae50e 100644
--- a/json/tests/draft6/minimum.json
+++ b/json/tests/draft6/minimum.json
@@ -45,7 +45,17 @@
"valid": true
},
{
- "description": "below the minimum is invalid",
+ "description": "boundary point with float is valid",
+ "data": -2.0,
+ "valid": true
+ },
+ {
+ "description": "float below the minimum is invalid",
+ "data": -2.0001,
+ "valid": false
+ },
+ {
+ "description": "int below the minimum is invalid",
"data": -3,
"valid": false
},
diff --git a/json/tests/draft7/const.json b/json/tests/draft7/const.json
index c741f60..1a55235 100644
--- a/json/tests/draft7/const.json
+++ b/json/tests/draft7/const.json
@@ -181,5 +181,62 @@
"valid": true
}
]
+ },
+ {
+ "description": "const with -2.0 matches integer and float types",
+ "schema": {"const": -2.0},
+ "tests": [
+ {
+ "description": "integer -2 is valid",
+ "data": -2,
+ "valid": true
+ },
+ {
+ "description": "integer 2 is invalid",
+ "data": 2,
+ "valid": false
+ },
+ {
+ "description": "float -2.0 is valid",
+ "data": -2.0,
+ "valid": true
+ },
+ {
+ "description": "float 2.0 is invalid",
+ "data": 2.0,
+ "valid": false
+ },
+ {
+ "description": "float -2.00001 is invalid",
+ "data": -2.00001,
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "float and integers are equal up to 64-bit representation limits",
+ "schema": {"const": 9007199254740992},
+ "tests": [
+ {
+ "description": "integer is valid",
+ "data": 9007199254740992,
+ "valid": true
+ },
+ {
+ "description": "integer minus one is invalid",
+ "data": 9007199254740991,
+ "valid": false
+ },
+ {
+ "description": "float is valid",
+ "data": 9007199254740992.0,
+ "valid": true
+ },
+ {
+ "description": "float minus one is invalid",
+ "data": 9007199254740991.0,
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft7/dependencies.json b/json/tests/draft7/dependencies.json
index 8dd78aa..a5e5428 100644
--- a/json/tests/draft7/dependencies.json
+++ b/json/tests/draft7/dependencies.json
@@ -57,6 +57,11 @@
"description": "object with one property",
"data": {"bar": 2},
"valid": true
+ },
+ {
+ "description": "non-object is valid",
+ "data": 1,
+ "valid": true
}
]
},
@@ -170,31 +175,6 @@
]
},
{
- "description": "empty array of dependencies",
- "schema": {
- "dependencies": {
- "foo": []
- }
- },
- "tests": [
- {
- "description": "object with property is valid",
- "data": { "foo": 1 },
- "valid": true
- },
- {
- "description": "empty object is valid",
- "data": {},
- "valid": true
- },
- {
- "description": "non-object is valid",
- "data": 1,
- "valid": true
- }
- ]
- },
- {
"description": "dependencies with escaped characters",
"schema": {
"dependencies": {
diff --git a/json/tests/draft7/enum.json b/json/tests/draft7/enum.json
index 32d7902..9327a70 100644
--- a/json/tests/draft7/enum.json
+++ b/json/tests/draft7/enum.json
@@ -53,6 +53,16 @@
"valid": true
},
{
+ "description": "wrong foo value",
+ "data": {"foo":"foot", "bar":"bar"},
+ "valid": false
+ },
+ {
+ "description": "wrong bar value",
+ "data": {"foo":"foo", "bar":"bart"},
+ "valid": false
+ },
+ {
"description": "missing optional property is valid",
"data": {"bar":"bar"},
"valid": true
diff --git a/json/tests/draft7/maximum.json b/json/tests/draft7/maximum.json
index 8150984..6844a39 100644
--- a/json/tests/draft7/maximum.json
+++ b/json/tests/draft7/maximum.json
@@ -24,5 +24,31 @@
"valid": true
}
]
+ },
+ {
+ "description": "maximum validation with unsigned integer",
+ "schema": {"maximum": 300},
+ "tests": [
+ {
+ "description": "below the maximum is invalid",
+ "data": 299.97,
+ "valid": true
+ },
+ {
+ "description": "boundary point integer is valid",
+ "data": 300,
+ "valid": true
+ },
+ {
+ "description": "boundary point float is valid",
+ "data": 300.00,
+ "valid": true
+ },
+ {
+ "description": "above the maximum is invalid",
+ "data": 300.5,
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft7/minimum.json b/json/tests/draft7/minimum.json
index 2a9c42b..21ae50e 100644
--- a/json/tests/draft7/minimum.json
+++ b/json/tests/draft7/minimum.json
@@ -45,7 +45,17 @@
"valid": true
},
{
- "description": "below the minimum is invalid",
+ "description": "boundary point with float is valid",
+ "data": -2.0,
+ "valid": true
+ },
+ {
+ "description": "float below the minimum is invalid",
+ "data": -2.0001,
+ "valid": false
+ },
+ {
+ "description": "int below the minimum is invalid",
"data": -3,
"valid": false
},
diff --git a/json/tox.ini b/json/tox.ini
index 9c4e949..72fd562 100644
--- a/json/tox.ini
+++ b/json/tox.ini
@@ -5,5 +5,5 @@ skipsdist = True
[testenv:sanity]
# used just for validating the structure of the test case files themselves
-deps = jsonschema
+deps = jsonschema>=3.2.0
commands = {envpython} bin/jsonschema_suite check