From 142f2028ab16af1d0f774ff8422ab004c910c2de Mon Sep 17 00:00:00 2001 From: Daniel Vasas Date: Thu, 7 Dec 2017 11:33:26 +0100 Subject: [PATCH 01/10] Add meta test loading mechanism. Add some meta tests. --- json/tests/draft4/meta/meta.json | 105 ++++++++++++++++++ .../tests/test_jsonschema_test_suite.py | 38 +++++-- 2 files changed, 131 insertions(+), 12 deletions(-) create mode 100644 json/tests/draft4/meta/meta.json diff --git a/json/tests/draft4/meta/meta.json b/json/tests/draft4/meta/meta.json new file mode 100644 index 000000000..552cfc80c --- /dev/null +++ b/json/tests/draft4/meta/meta.json @@ -0,0 +1,105 @@ +[ + { + "description": "invalid type", + "tests": [ + { + "description": "is float", + "schema": { + "type": "float" + } + }, + { + "description": "contains duplicate", + "schema": { + "type": [ + "null", + "null" + ] + } + } + ] + }, + { + "description": "invalid enum", + "tests": [ + { + "description": "not array", + "schema": { + "enum": "not_an_array" + } + }, + { + "description": "empty array", + "schema": { + "enum": [] + } + }, + { + "description": "contains duplicate", + "schema": { + "enum": [ + "not_unique", + "not_unique" + ] + } + } + ] + }, + { + "description": "invalid multipleOf", + "tests": [ + { + "description": "is string not number", + "schema": { + "multipleOf": "one" + } + }, + { + "description": "is null not number", + "schema": { + "multipleOf": null + } + }, + { + "description": "is not greater than zero", + "schema": { + "multipleOf": 0 + } + } + ] + }, + { + "description": "invalid maximum", + "tests": [ + { + "description": "is string not number", + "schema": { + "multipleOf": "one" + } + }, + { + "description": "is null not number", + "schema": { + "multipleOf": null + } + } + ] + }, + { + "description": "invalid exclusiveMaximum", + "tests": [ + { + "description": "is string not number", + "schema": { + "multipleOf": "one" + } + }, + { + "description": "is null not number", + "schema": { + "multipleOf": null + } + } + ] + } +] diff --git a/jsonschema/tests/test_jsonschema_test_suite.py b/jsonschema/tests/test_jsonschema_test_suite.py index 22ce754cc..f39083911 100644 --- a/jsonschema/tests/test_jsonschema_test_suite.py +++ b/jsonschema/tests/test_jsonschema_test_suite.py @@ -120,6 +120,31 @@ def add_test_methods(test_class): return add_test_methods +def load_meta_cases(meta_tests_file, basedir=TESTS_DIR): + def add_test_methods(test_class): + with open(os.path.join(basedir, meta_tests_file)) as test_file: + for case in json.load(test_file): + for (idx, test) in enumerate(case["tests"]): + name = "test_meta_%s_%s_%s" % ( + case["description"], + idx, + re.sub(r"[\W ]+", "_", test["description"]), + ) + assert not hasattr(test_class, name), name + test_method = create_meta_test(test["schema"]) + setattr(test_class, name, test_method) + return test_class + return add_test_methods + + +def create_meta_test(schema): + def test(self): + kwargs = getattr(self, "validator_kwargs", {}) + with self.assertRaises(SchemaError): + validate({}, schema, cls=self.validator_class, **kwargs) + return test + + def skip_tests_containing_descriptions(descriptions_and_reasons): def skipper(case, test): return next( @@ -275,22 +300,11 @@ def test_minItems_invalid_string(self): ) @load_json_cases("draft4/optional/bignum.json") @load_json_cases("draft4/optional/zeroTerminatedFloats.json") +@load_meta_cases("draft4/meta/meta.json") class TestDraft4(unittest.TestCase, TypesMixin, DecimalMixin, FormatMixin): validator_class = Draft4Validator validator_kwargs = {"format_checker": draft4_format_checker} - # TODO: we're in need of more meta schema tests - def test_invalid_properties(self): - with self.assertRaises(SchemaError): - validate({}, {"properties": {"test": True}}, - cls=self.validator_class) - - def test_minItems_invalid_string(self): - with self.assertRaises(SchemaError): - # needs to be an integer - validate([1], {"minItems": "1"}, cls=self.validator_class) - - class RemoteRefResolutionMixin(object): def setUp(self): patch = mock.patch("jsonschema.validators.requests") From c27df7db7c29c052104753abb0ea968dc464f96a Mon Sep 17 00:00:00 2001 From: Daniel Vasas Date: Thu, 7 Dec 2017 11:57:56 +0100 Subject: [PATCH 02/10] Add meta tests. --- json/tests/draft4/meta/meta.json | 58 ++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/json/tests/draft4/meta/meta.json b/json/tests/draft4/meta/meta.json index 552cfc80c..518363664 100644 --- a/json/tests/draft4/meta/meta.json +++ b/json/tests/draft4/meta/meta.json @@ -77,6 +77,12 @@ "multipleOf": "one" } }, + { + "description": "is boolean not number", + "schema": { + "multipleOf": true + } + }, { "description": "is null not number", "schema": { @@ -94,6 +100,58 @@ "multipleOf": "one" } }, + { + "description": "is boolean not number", + "schema": { + "multipleOf": true + } + }, + { + "description": "is null not number", + "schema": { + "multipleOf": null + } + } + ] + }, + { + "description": "invalid minimum", + "tests": [ + { + "description": "is string not number", + "schema": { + "multipleOf": "one" + } + }, + { + "description": "is boolean not number", + "schema": { + "multipleOf": true + } + }, + { + "description": "is null not number", + "schema": { + "multipleOf": null + } + } + ] + }, + { + "description": "invalid exclusiveMinimum", + "tests": [ + { + "description": "is string not number", + "schema": { + "multipleOf": "one" + } + }, + { + "description": "is boolean not number", + "schema": { + "multipleOf": true + } + }, { "description": "is null not number", "schema": { From 5e86b23c2b4e1ddbdc9a9e319232cdd4c30754dd Mon Sep 17 00:00:00 2001 From: Daniel Vasas Date: Thu, 7 Dec 2017 12:01:33 +0100 Subject: [PATCH 03/10] Finish Number keywords tests. --- json/tests/draft4/meta/meta.json | 60 ++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/json/tests/draft4/meta/meta.json b/json/tests/draft4/meta/meta.json index 518363664..c237cf106 100644 --- a/json/tests/draft4/meta/meta.json +++ b/json/tests/draft4/meta/meta.json @@ -60,6 +60,18 @@ "multipleOf": null } }, + { + "description": "is array not number", + "schema": { + "multipleOf": [1] + } + }, + { + "description": "is array not object", + "schema": { + "multipleOf": {} + } + }, { "description": "is not greater than zero", "schema": { @@ -83,6 +95,18 @@ "multipleOf": true } }, + { + "description": "is array not number", + "schema": { + "multipleOf": [1] + } + }, + { + "description": "is array not object", + "schema": { + "multipleOf": {} + } + }, { "description": "is null not number", "schema": { @@ -106,6 +130,18 @@ "multipleOf": true } }, + { + "description": "is array not number", + "schema": { + "multipleOf": [1] + } + }, + { + "description": "is array not object", + "schema": { + "multipleOf": {} + } + }, { "description": "is null not number", "schema": { @@ -129,6 +165,18 @@ "multipleOf": true } }, + { + "description": "is array not number", + "schema": { + "multipleOf": [1] + } + }, + { + "description": "is array not object", + "schema": { + "multipleOf": {} + } + }, { "description": "is null not number", "schema": { @@ -152,6 +200,18 @@ "multipleOf": true } }, + { + "description": "is array not number", + "schema": { + "multipleOf": [1] + } + }, + { + "description": "is array not object", + "schema": { + "multipleOf": {} + } + }, { "description": "is null not number", "schema": { From f9785cbefbbd1623015060fe76865c2c1b6a8496 Mon Sep 17 00:00:00 2001 From: Daniel Vasas Date: Thu, 7 Dec 2017 13:32:27 +0100 Subject: [PATCH 04/10] Add String keywords tests. --- json/tests/draft4/meta/meta.json | 128 ++++++++++++++++++++++++++++--- 1 file changed, 118 insertions(+), 10 deletions(-) diff --git a/json/tests/draft4/meta/meta.json b/json/tests/draft4/meta/meta.json index c237cf106..316caa607 100644 --- a/json/tests/draft4/meta/meta.json +++ b/json/tests/draft4/meta/meta.json @@ -63,11 +63,13 @@ { "description": "is array not number", "schema": { - "multipleOf": [1] + "multipleOf": [ + 1 + ] } }, { - "description": "is array not object", + "description": "is object not number", "schema": { "multipleOf": {} } @@ -98,11 +100,13 @@ { "description": "is array not number", "schema": { - "multipleOf": [1] + "multipleOf": [ + 1 + ] } }, { - "description": "is array not object", + "description": "is object not number", "schema": { "multipleOf": {} } @@ -133,11 +137,13 @@ { "description": "is array not number", "schema": { - "multipleOf": [1] + "multipleOf": [ + 1 + ] } }, { - "description": "is array not object", + "description": "is object not number", "schema": { "multipleOf": {} } @@ -168,11 +174,13 @@ { "description": "is array not number", "schema": { - "multipleOf": [1] + "multipleOf": [ + 1 + ] } }, { - "description": "is array not object", + "description": "is object not number", "schema": { "multipleOf": {} } @@ -203,11 +211,50 @@ { "description": "is array not number", "schema": { - "multipleOf": [1] + "multipleOf": [ + 1 + ] + } + }, + { + "description": "is object not number", + "schema": { + "multipleOf": {} + } + }, + { + "description": "is null not number", + "schema": { + "multipleOf": null + } + } + ] + }, + { + "description": "invalid maxLength", + "tests": [ + { + "description": "is string not number", + "schema": { + "multipleOf": "one" + } + }, + { + "description": "is boolean not number", + "schema": { + "multipleOf": true + } + }, + { + "description": "is array not number", + "schema": { + "multipleOf": [ + 1 + ] } }, { - "description": "is array not object", + "description": "is object not number", "schema": { "multipleOf": {} } @@ -217,6 +264,67 @@ "schema": { "multipleOf": null } + }, + { + "description": "is decimal not integer", + "schema": { + "maxLength": 1.5 + } + }, + { + "description": "is negative", + "schema": { + "maxLength": -1 + } + } + ] + }, + { + "description": "invalid minLength", + "tests": [ + { + "description": "is string not number", + "schema": { + "multipleOf": "one" + } + }, + { + "description": "is boolean not number", + "schema": { + "multipleOf": true + } + }, + { + "description": "is array not number", + "schema": { + "multipleOf": [ + 1 + ] + } + }, + { + "description": "is object not number", + "schema": { + "multipleOf": {} + } + }, + { + "description": "is null not number", + "schema": { + "multipleOf": null + } + }, + { + "description": "is decimal not integer", + "schema": { + "maxLength": 1.5 + } + }, + { + "description": "is negative", + "schema": { + "maxLength": -1 + } } ] } From c093907dced3f9960a28c26a491e0729d9807c74 Mon Sep 17 00:00:00 2001 From: Daniel Vasas Date: Thu, 7 Dec 2017 13:45:22 +0100 Subject: [PATCH 05/10] Fix testmethod naming bug. --- jsonschema/tests/test_jsonschema_test_suite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonschema/tests/test_jsonschema_test_suite.py b/jsonschema/tests/test_jsonschema_test_suite.py index f39083911..3b1d4cd4a 100644 --- a/jsonschema/tests/test_jsonschema_test_suite.py +++ b/jsonschema/tests/test_jsonschema_test_suite.py @@ -126,7 +126,7 @@ def add_test_methods(test_class): for case in json.load(test_file): for (idx, test) in enumerate(case["tests"]): name = "test_meta_%s_%s_%s" % ( - case["description"], + re.sub(r"[\W ]+", "_", case["description"]), idx, re.sub(r"[\W ]+", "_", test["description"]), ) From a4bf85fbe57d918290571047279c7674b7f85f32 Mon Sep 17 00:00:00 2001 From: Daniel Vasas Date: Thu, 7 Dec 2017 14:02:28 +0100 Subject: [PATCH 06/10] Add Array tests; fix copy paste errors in tests. --- json/tests/draft4/meta/meta.json | 228 +++++++++++++++++++++++++++---- 1 file changed, 198 insertions(+), 30 deletions(-) diff --git a/json/tests/draft4/meta/meta.json b/json/tests/draft4/meta/meta.json index 316caa607..f53ae9a30 100644 --- a/json/tests/draft4/meta/meta.json +++ b/json/tests/draft4/meta/meta.json @@ -88,19 +88,19 @@ { "description": "is string not number", "schema": { - "multipleOf": "one" + "maximum": "one" } }, { "description": "is boolean not number", "schema": { - "multipleOf": true + "maximum": true } }, { "description": "is array not number", "schema": { - "multipleOf": [ + "maximum": [ 1 ] } @@ -108,13 +108,13 @@ { "description": "is object not number", "schema": { - "multipleOf": {} + "maximum": {} } }, { "description": "is null not number", "schema": { - "multipleOf": null + "maximum": null } } ] @@ -125,19 +125,19 @@ { "description": "is string not number", "schema": { - "multipleOf": "one" + "exclusiveMaximum": "one" } }, { "description": "is boolean not number", "schema": { - "multipleOf": true + "exclusiveMaximum": true } }, { "description": "is array not number", "schema": { - "multipleOf": [ + "exclusiveMaximum": [ 1 ] } @@ -145,13 +145,13 @@ { "description": "is object not number", "schema": { - "multipleOf": {} + "exclusiveMaximum": {} } }, { "description": "is null not number", "schema": { - "multipleOf": null + "exclusiveMaximum": null } } ] @@ -162,19 +162,19 @@ { "description": "is string not number", "schema": { - "multipleOf": "one" + "minimum": "one" } }, { "description": "is boolean not number", "schema": { - "multipleOf": true + "minimum": true } }, { "description": "is array not number", "schema": { - "multipleOf": [ + "minimum": [ 1 ] } @@ -182,13 +182,13 @@ { "description": "is object not number", "schema": { - "multipleOf": {} + "minimum": {} } }, { "description": "is null not number", "schema": { - "multipleOf": null + "minimum": null } } ] @@ -199,19 +199,19 @@ { "description": "is string not number", "schema": { - "multipleOf": "one" + "exclusiveMinimum": "one" } }, { "description": "is boolean not number", "schema": { - "multipleOf": true + "exclusiveMinimum": true } }, { "description": "is array not number", "schema": { - "multipleOf": [ + "exclusiveMinimum": [ 1 ] } @@ -219,13 +219,13 @@ { "description": "is object not number", "schema": { - "multipleOf": {} + "exclusiveMinimum": {} } }, { "description": "is null not number", "schema": { - "multipleOf": null + "exclusiveMinimum": null } } ] @@ -236,19 +236,19 @@ { "description": "is string not number", "schema": { - "multipleOf": "one" + "maxLength": "one" } }, { "description": "is boolean not number", "schema": { - "multipleOf": true + "maxLength": true } }, { "description": "is array not number", "schema": { - "multipleOf": [ + "maxLength": [ 1 ] } @@ -256,13 +256,13 @@ { "description": "is object not number", "schema": { - "multipleOf": {} + "maxLength": {} } }, { "description": "is null not number", "schema": { - "multipleOf": null + "maxLength": null } }, { @@ -285,19 +285,19 @@ { "description": "is string not number", "schema": { - "multipleOf": "one" + "minLength": "one" } }, { "description": "is boolean not number", "schema": { - "multipleOf": true + "minLength": true } }, { "description": "is array not number", "schema": { - "multipleOf": [ + "minLength": [ 1 ] } @@ -305,13 +305,13 @@ { "description": "is object not number", "schema": { - "multipleOf": {} + "minLength": {} } }, { "description": "is null not number", "schema": { - "multipleOf": null + "minLength": null } }, { @@ -327,5 +327,173 @@ } } ] + }, + { + "description": "Array - invalid items", + "tests": [ + { + "description": "not a schema", + "schema": { + "items": "not a schema" + } + } + ] + }, + { + "description": "Array - invalid additionalItems", + "tests": [ + { + "description": "not a schema", + "schema": { + "additionalItems": "not a schema" + } + } + ] + }, + { + "description": "Array - invalid contains", + "tests": [ + { + "description": "not a schema", + "schema": { + "contains": "not a schema" + } + } + ] + }, + { + "description": "Array - invalid maxItems", + "tests": [ + { + "description": "is string not number", + "schema": { + "maxItems": "one" + } + }, + { + "description": "is boolean not number", + "schema": { + "maxItems": true + } + }, + { + "description": "is array not number", + "schema": { + "maxItems": [ + 1 + ] + } + }, + { + "description": "is object not number", + "schema": { + "maxItems": {} + } + }, + { + "description": "is null not number", + "schema": { + "maxItems": null + } + }, + { + "description": "is decimal not integer", + "schema": { + "maxItems": 1.5 + } + }, + { + "description": "is negative", + "schema": { + "maxItems": -1 + } + } + ] + }, + { + "description": "Array - invalid minItems", + "tests": [ + { + "description": "is string not number", + "schema": { + "minItems": "one" + } + }, + { + "description": "is boolean not number", + "schema": { + "minItems": true + } + }, + { + "description": "is array not number", + "schema": { + "minItems": [ + 1 + ] + } + }, + { + "description": "is object not number", + "schema": { + "minItems": {} + } + }, + { + "description": "is null not number", + "schema": { + "minItems": null + } + }, + { + "description": "is decimal not integer", + "schema": { + "minItems": 1.5 + } + }, + { + "description": "is negative", + "schema": { + "minItems": -1 + } + } + ] + }, + { + "description": "Array - invalid uniqueItems", + "tests": [ + { + "description": "is string not boolean", + "schema": { + "uniqueItems": "one" + } + }, + { + "description": "is number not boolean", + "schema": { + "uniqueItems": 1 + } + }, + { + "description": "is array not boolean", + "schema": { + "uniqueItems": [ + true + ] + } + }, + { + "description": "is object not boolean", + "schema": { + "uniqueItems": {} + } + }, + { + "description": "is null not boolean", + "schema": { + "uniqueItems": null + } + } + ] } ] From 3c5e39ea1b43343521e37827124623c6560c4924 Mon Sep 17 00:00:00 2001 From: Daniel Vasas Date: Thu, 7 Dec 2017 14:05:59 +0100 Subject: [PATCH 07/10] Rename testcases. --- json/tests/draft4/meta/meta.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/json/tests/draft4/meta/meta.json b/json/tests/draft4/meta/meta.json index f53ae9a30..aef298882 100644 --- a/json/tests/draft4/meta/meta.json +++ b/json/tests/draft4/meta/meta.json @@ -1,6 +1,6 @@ [ { - "description": "invalid type", + "description": "Any type - invalid type", "tests": [ { "description": "is float", @@ -20,7 +20,7 @@ ] }, { - "description": "invalid enum", + "description": "Any type - invalid enum", "tests": [ { "description": "not array", @@ -46,7 +46,7 @@ ] }, { - "description": "invalid multipleOf", + "description": "Numeric - invalid multipleOf", "tests": [ { "description": "is string not number", @@ -83,7 +83,7 @@ ] }, { - "description": "invalid maximum", + "description": "Numeric - invalid maximum", "tests": [ { "description": "is string not number", @@ -120,7 +120,7 @@ ] }, { - "description": "invalid exclusiveMaximum", + "description": "Numeric - invalid exclusiveMaximum", "tests": [ { "description": "is string not number", @@ -157,7 +157,7 @@ ] }, { - "description": "invalid minimum", + "description": "Numeric - invalid minimum", "tests": [ { "description": "is string not number", @@ -194,7 +194,7 @@ ] }, { - "description": "invalid exclusiveMinimum", + "description": "Numeric - invalid exclusiveMinimum", "tests": [ { "description": "is string not number", @@ -231,7 +231,7 @@ ] }, { - "description": "invalid maxLength", + "description": "String - invalid maxLength", "tests": [ { "description": "is string not number", @@ -280,7 +280,7 @@ ] }, { - "description": "invalid minLength", + "description": "String - invalid minLength", "tests": [ { "description": "is string not number", From 148b5281ed754fc65ba4a6158245a092d7fa741e Mon Sep 17 00:00:00 2001 From: Daniel Vasas Date: Thu, 7 Dec 2017 14:13:25 +0100 Subject: [PATCH 08/10] Remove - mistakenly added - 'Array.contains' testcase. --- json/tests/draft4/meta/meta.json | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/json/tests/draft4/meta/meta.json b/json/tests/draft4/meta/meta.json index aef298882..e161ddbf0 100644 --- a/json/tests/draft4/meta/meta.json +++ b/json/tests/draft4/meta/meta.json @@ -350,17 +350,6 @@ } ] }, - { - "description": "Array - invalid contains", - "tests": [ - { - "description": "not a schema", - "schema": { - "contains": "not a schema" - } - } - ] - }, { "description": "Array - invalid maxItems", "tests": [ From fac089294a240433687a492c112f6c2518613cae Mon Sep 17 00:00:00 2001 From: Daniel Vasas Date: Thu, 7 Dec 2017 14:33:20 +0100 Subject: [PATCH 09/10] Add Object testcases. --- json/tests/draft4/meta/meta.json | 206 +++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) diff --git a/json/tests/draft4/meta/meta.json b/json/tests/draft4/meta/meta.json index e161ddbf0..1c32dc421 100644 --- a/json/tests/draft4/meta/meta.json +++ b/json/tests/draft4/meta/meta.json @@ -484,5 +484,211 @@ } } ] + }, + { + "description": "Object - invalid maxProperties", + "tests": [ + { + "description": "is string not number", + "schema": { + "maxProperties": "one" + } + }, + { + "description": "is boolean not number", + "schema": { + "maxProperties": true + } + }, + { + "description": "is array not number", + "schema": { + "maxProperties": [ + 1 + ] + } + }, + { + "description": "is object not number", + "schema": { + "maxProperties": {} + } + }, + { + "description": "is null not number", + "schema": { + "maxProperties": null + } + }, + { + "description": "is decimal not integer", + "schema": { + "maxProperties": 1.5 + } + }, + { + "description": "is negative", + "schema": { + "maxProperties": -1 + } + } + ] + }, + { + "description": "Object - invalid minProperties", + "tests": [ + { + "description": "is string not number", + "schema": { + "minProperties": "one" + } + }, + { + "description": "is boolean not number", + "schema": { + "minProperties": true + } + }, + { + "description": "is array not number", + "schema": { + "minProperties": [ + 1 + ] + } + }, + { + "description": "is object not number", + "schema": { + "minProperties": {} + } + }, + { + "description": "is null not number", + "schema": { + "minProperties": null + } + }, + { + "description": "is decimal not integer", + "schema": { + "minProperties": 1.5 + } + }, + { + "description": "is negative", + "schema": { + "minProperties": -1 + } + } + ] + }, + { + "description": "Object - invalid required", + "tests": [ + { + "description": "is string not array", + "schema": { + "required": "one" + } + }, + { + "description": "is empty array", + "schema": { + "required": [] + } + }, + { + "description": "array contains non-string", + "schema": { + "required": [ + 1 + ] + } + }, + { + "description": "array elements not unique", + "schema": { + "required": [ + "prop", + "prop" + ] + } + } + ] + }, + { + "description": "Object - invalid additionalProperties", + "tests": [ + { + "description": "is string not boolean", + "schema": { + "additionalProperties": "one" + } + }, + { + "description": "is number not boolean", + "schema": { + "additionalProperties": 1 + } + }, + { + "description": "is array not boolean", + "schema": { + "additionalProperties": [ + true + ] + } + }, + { + "description": "not a schema", + "schema": { + "additionalProperties": "not a schema" + } + }, + { + "description": "is null not boolean", + "schema": { + "additionalProperties": null + } + } + ] + }, + { + "description": "Object - invalid properties", + "tests": [ + { + "description": "is string not object", + "schema": { + "properties": "one" + } + }, + { + "description": "is number not object", + "schema": { + "properties": 1 + } + }, + { + "description": "is array not object", + "schema": { + "properties": [ + true + ] + } + }, + { + "description": "child not a schema", + "schema": { + "properties": {"child": "not a schema"} + } + }, + { + "description": "is null not object", + "schema": { + "properties": null + } + } + ] } ] From 12ed4a50d5cd5039ae97a4b24ba3e98a23652859 Mon Sep 17 00:00:00 2001 From: Daniel Vasas Date: Thu, 7 Dec 2017 14:40:16 +0100 Subject: [PATCH 10/10] Add remaining 'any' type keyword tests. --- json/tests/draft4/meta/meta.json | 88 ++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/json/tests/draft4/meta/meta.json b/json/tests/draft4/meta/meta.json index 1c32dc421..3774bf871 100644 --- a/json/tests/draft4/meta/meta.json +++ b/json/tests/draft4/meta/meta.json @@ -45,6 +45,94 @@ } ] }, + { + "description": "Any type - invalid allOf", + "tests": [ + { + "description": "not array", + "schema": { + "allOf": "not_an_array" + } + }, + { + "description": "empty array", + "schema": { + "allOf": [] + } + }, + { + "description": "not a schema", + "schema": { + "allOf": [ + "not a schema" + ] + } + } + ] + }, + { + "description": "Any type - invalid anyOf", + "tests": [ + { + "description": "not array", + "schema": { + "anyOf": "not_an_array" + } + }, + { + "description": "empty array", + "schema": { + "anyOf": [] + } + }, + { + "description": "not a schema", + "schema": { + "anyOf": [ + "not a schema" + ] + } + } + ] + }, + { + "description": "Any type - invalid oneOf", + "tests": [ + { + "description": "not array", + "schema": { + "oneOf": "not_an_array" + } + }, + { + "description": "empty array", + "schema": { + "oneOf": [] + } + }, + { + "description": "not a schema", + "schema": { + "oneOf": [ + "not a schema" + ] + } + } + ] + }, + { + "description": "Any type - invalid not", + "tests": [ + { + "description": "not a schema", + "schema": { + "not": [ + "not a schema" + ] + } + } + ] + }, { "description": "Numeric - invalid multipleOf", "tests": [