From 6956f20558890cbd60b5e0817144158574c89f0d Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Wed, 15 Feb 2017 20:07:09 +0000 Subject: [PATCH 01/10] draft-06: boolean root schema --- tests/draft6/boolean_schema.json | 104 +++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 tests/draft6/boolean_schema.json diff --git a/tests/draft6/boolean_schema.json b/tests/draft6/boolean_schema.json new file mode 100644 index 00000000..6d40f23f --- /dev/null +++ b/tests/draft6/boolean_schema.json @@ -0,0 +1,104 @@ +[ + { + "description": "boolean schema 'true'", + "schema": true, + "tests": [ + { + "description": "number is valid", + "data": 1, + "valid": true + }, + { + "description": "string is valid", + "data": "foo", + "valid": true + }, + { + "description": "boolean true is valid", + "data": true, + "valid": true + }, + { + "description": "boolean false is valid", + "data": false, + "valid": true + }, + { + "description": "null is valid", + "data": null, + "valid": true + }, + { + "description": "object is valid", + "data": {"foo": "bar"}, + "valid": true + }, + { + "description": "empty object is valid", + "data": {}, + "valid": true + }, + { + "description": "array is valid", + "data": ["foo"], + "valid": true + }, + { + "description": "empty array is valid", + "data": [], + "valid": true + } + ] + }, + { + "description": "boolean schema 'false'", + "schema": false, + "tests": [ + { + "description": "number is invalid", + "data": 1, + "valid": false + }, + { + "description": "string is invalid", + "data": "foo", + "valid": false + }, + { + "description": "boolean true is invalid", + "data": true, + "valid": false + }, + { + "description": "boolean false is invalid", + "data": false, + "valid": false + }, + { + "description": "null is invalid", + "data": null, + "valid": false + }, + { + "description": "object is invalid", + "data": {"foo": "bar"}, + "valid": false + }, + { + "description": "empty object is invalid", + "data": {}, + "valid": false + }, + { + "description": "array is invalid", + "data": ["foo"], + "valid": false + }, + { + "description": "empty array is invalid", + "data": [], + "valid": false + } + ] + } +] From 77e0411cbf29d04b00ace06e37414986ab231b57 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sat, 25 Feb 2017 22:17:15 +0000 Subject: [PATCH 02/10] draft-06: properties keyword with boolean schemas --- tests/draft6/properties.json | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/draft6/properties.json b/tests/draft6/properties.json index cd1644dc..d56a9608 100644 --- a/tests/draft6/properties.json +++ b/tests/draft6/properties.json @@ -88,5 +88,36 @@ "valid": false } ] + }, + { + "description": "properties with boolean schema", + "schema": { + "properties": { + "foo": true, + "bar": false + } + }, + "tests": [ + { + "description": "no property present is valid", + "data": {}, + "valid": true + }, + { + "description": "only 'true' property present is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "only 'false' property present is invalid", + "data": {"bar": 2}, + "valid": false + }, + { + "description": "both properties present is invalid", + "data": {"foo": 1, "bar": 2}, + "valid": false + } + ] } ] From 53858ff3edbc9e4573a57d32ff9fb9e17226126f Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 26 Feb 2017 16:14:39 +0000 Subject: [PATCH 03/10] draft-06: items keyword with boolean schemas --- tests/draft6/items.json | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tests/draft6/items.json b/tests/draft6/items.json index e41d92ec..85552bfe 100644 --- a/tests/draft6/items.json +++ b/tests/draft6/items.json @@ -57,5 +57,60 @@ "valid": true } ] + }, + { + "description": "items with boolean schema (true)", + "schema": {"items": true}, + "tests": [ + { + "description": "any array is valid", + "data": [ 1, "foo", true ], + "valid": true + }, + { + "description": "empty array is valid", + "data": [], + "valid": true + } + ] + }, + { + "description": "items with boolean schema (false)", + "schema": {"items": false}, + "tests": [ + { + "description": "any non-empty array is invalid", + "data": [ 1, "foo", true ], + "valid": false + }, + { + "description": "empty array is valid", + "data": [], + "valid": true + } + ] + }, + { + "description": "items with boolean schemas", + "schema": { + "items": [true, false] + }, + "tests": [ + { + "description": "array with one item is valid", + "data": [ 1 ], + "valid": true + }, + { + "description": "array with two items is invalid", + "data": [ 1, "foo" ], + "valid": false + }, + { + "description": "empty array is valid", + "data": [], + "valid": true + } + ] } ] From 5a888a6220603ed2ba28ac17f11ada05518d0ce7 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 26 Feb 2017 16:20:35 +0000 Subject: [PATCH 04/10] draft-06: dependencies keyword with boolean subschemas --- tests/draft6/dependencies.json | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/draft6/dependencies.json b/tests/draft6/dependencies.json index 84bb4fb7..a9b33345 100644 --- a/tests/draft6/dependencies.json +++ b/tests/draft6/dependencies.json @@ -127,5 +127,36 @@ "valid": false } ] + }, + { + "description": "dependencies with boolean subschemas", + "schema": { + "dependencies": { + "foo": true, + "bar": false + } + }, + "tests": [ + { + "description": "object with property having schema true is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "object with property having schema false is invalid", + "data": {"bar": 2}, + "valid": false + }, + { + "description": "object with both properties is invalid", + "data": {"foo": 1, "bar": 2}, + "valid": false + }, + { + "description": "empty object is valid", + "data": {}, + "valid": true + } + ] } ] From fa991350f0d877794d7e28f4de19485014ddd06e Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 26 Feb 2017 16:24:06 +0000 Subject: [PATCH 05/10] draft-06: patternProperties keyword with boolean schemas --- tests/draft6/patternProperties.json | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/draft6/patternProperties.json b/tests/draft6/patternProperties.json index 18586e5d..b1f2d355 100644 --- a/tests/draft6/patternProperties.json +++ b/tests/draft6/patternProperties.json @@ -106,5 +106,36 @@ "valid": false } ] + }, + { + "description": "patternProperties with boolean schemas", + "schema": { + "patternProperties": { + "f.*": true, + "b.*": false + } + }, + "tests": [ + { + "description": "object with property matching schema true is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "object with property matching schema false is invalid", + "data": {"bar": 2}, + "valid": false + }, + { + "description": "object with both properties is invalid", + "data": {"foo": 1, "bar": 2}, + "valid": false + }, + { + "description": "empty object is valid", + "data": {}, + "valid": true + } + ] } ] From 9c05d1846d2e5b6ab082af4f4368091c73870c1b Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 26 Feb 2017 16:27:27 +0000 Subject: [PATCH 06/10] draft-06: propertyNames keyword with boolean schemas --- tests/draft6/propertyNames.json | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/draft6/propertyNames.json b/tests/draft6/propertyNames.json index 165d17c7..2804b41d 100644 --- a/tests/draft6/propertyNames.json +++ b/tests/draft6/propertyNames.json @@ -32,5 +32,37 @@ "valid": true } ] + }, + { + "description": "propertyNames with boolean schema true", + "schema": {"propertyNames": true}, + "tests": [ + { + "description": "object with any properties is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "empty object is valid", + "data": {}, + "valid": true + } + ] + }, + { + "description": "propertyNames with boolean schema false", + "schema": {"propertyNames": false}, + "tests": [ + { + "description": "object with any properties is invalid", + "data": {"foo": 1}, + "valid": false + }, + { + "description": "empty object is valid", + "data": {}, + "valid": true + } + ] } ] From b6b00f9e92b7d69844ca93e89d241a74000987ea Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 26 Feb 2017 16:31:16 +0000 Subject: [PATCH 07/10] draft-06: contains keyword with boolean schemas --- tests/draft6/contains.json | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/draft6/contains.json b/tests/draft6/contains.json index 3f79a1b0..b7ae5a25 100644 --- a/tests/draft6/contains.json +++ b/tests/draft6/contains.json @@ -59,5 +59,37 @@ "valid": false } ] + }, + { + "description": "contains keyword with boolean schema true", + "schema": {"contains": true}, + "tests": [ + { + "description": "any non-empty array is valid", + "data": ["foo"], + "valid": true + }, + { + "description": "empty array is invalid", + "data": [], + "valid": false + } + ] + }, + { + "description": "contains keyword with boolean schema false", + "schema": {"contains": false}, + "tests": [ + { + "description": "any non-empty array is invalid", + "data": ["foo"], + "valid": false + }, + { + "description": "empty array is invalid", + "data": [], + "valid": false + } + ] } ] From b714a18116f4f658e289c281a1c9577f94c05336 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 26 Feb 2017 16:34:02 +0000 Subject: [PATCH 08/10] draft-06: not keyword with boolean schemas --- tests/draft6/not.json | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/draft6/not.json b/tests/draft6/not.json index cbb7f46b..98de0eda 100644 --- a/tests/draft6/not.json +++ b/tests/draft6/not.json @@ -91,6 +91,27 @@ "valid": true } ] + }, + { + "description": "not with boolean schema true", + "schema": {"not": true}, + "tests": [ + { + "description": "any value is invalid", + "data": "foo", + "valid": false + } + ] + }, + { + "description": "not with boolean schema false", + "schema": {"not": false}, + "tests": [ + { + "description": "any value is valid", + "data": "foo", + "valid": true + } + ] } - ] From d62b754cf6d6054bee6e9c9151db632b04080834 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 26 Feb 2017 16:40:21 +0000 Subject: [PATCH 09/10] draft-06: allOf, anyOf, oneOf keywords with boolean schemas --- tests/draft6/allOf.json | 33 +++++++++++++++++++++++++++++++ tests/draft6/anyOf.json | 33 +++++++++++++++++++++++++++++++ tests/draft6/oneOf.json | 44 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) diff --git a/tests/draft6/allOf.json b/tests/draft6/allOf.json index bbb5f89e..00c016cd 100644 --- a/tests/draft6/allOf.json +++ b/tests/draft6/allOf.json @@ -108,5 +108,38 @@ "valid": false } ] + }, + { + "description": "allOf with boolean schemas, all true", + "schema": {"allOf": [true, true]}, + "tests": [ + { + "description": "any value is valid", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "allOf with boolean schemas, some false", + "schema": {"allOf": [true, false]}, + "tests": [ + { + "description": "any value is invalid", + "data": "foo", + "valid": false + } + ] + }, + { + "description": "allOf with boolean schemas, all false", + "schema": {"allOf": [false, false]}, + "tests": [ + { + "description": "any value is invalid", + "data": "foo", + "valid": false + } + ] } ] diff --git a/tests/draft6/anyOf.json b/tests/draft6/anyOf.json index a58714af..1ea31ed9 100644 --- a/tests/draft6/anyOf.json +++ b/tests/draft6/anyOf.json @@ -64,5 +64,38 @@ "valid": false } ] + }, + { + "description": "anyOf with boolean schemas, all true", + "schema": {"anyOf": [true, true]}, + "tests": [ + { + "description": "any value is valid", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "anyOf with boolean schemas, some true", + "schema": {"anyOf": [true, false]}, + "tests": [ + { + "description": "any value is valid", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "anyOf with boolean schemas, all false", + "schema": {"anyOf": [false, false]}, + "tests": [ + { + "description": "any value is invalid", + "data": "foo", + "valid": false + } + ] } ] diff --git a/tests/draft6/oneOf.json b/tests/draft6/oneOf.json index 1eaa4e47..df07e0bb 100644 --- a/tests/draft6/oneOf.json +++ b/tests/draft6/oneOf.json @@ -64,5 +64,49 @@ "valid": false } ] + }, + { + "description": "oneOf with boolean schemas, all true", + "schema": {"oneOf": [true, true, true]}, + "tests": [ + { + "description": "any value is invalid", + "data": "foo", + "valid": false + } + ] + }, + { + "description": "oneOf with boolean schemas, one true", + "schema": {"oneOf": [true, false, false]}, + "tests": [ + { + "description": "any value is valid", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "oneOf with boolean schemas, more than one true", + "schema": {"oneOf": [true, true, false]}, + "tests": [ + { + "description": "any value is invalid", + "data": "foo", + "valid": false + } + ] + }, + { + "description": "oneOf with boolean schemas, all false", + "schema": {"oneOf": [false, false, false]}, + "tests": [ + { + "description": "any value is invalid", + "data": "foo", + "valid": false + } + ] } ] From e86adb2801e4330446bfce2ee8bd0fc08f71c16a Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sun, 26 Feb 2017 16:43:00 +0000 Subject: [PATCH 10/10] draft-06: $ref to boolean schemas --- tests/draft6/ref.json | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/draft6/ref.json b/tests/draft6/ref.json index e9867a8d..a859f988 100644 --- a/tests/draft6/ref.json +++ b/tests/draft6/ref.json @@ -208,5 +208,37 @@ "valid": false } ] + }, + { + "description": "$ref to boolean schema true", + "schema": { + "$ref": "#/definitions/bool", + "definitions": { + "bool": true + } + }, + "tests": [ + { + "description": "any value is valid", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "$ref to boolean schema false", + "schema": { + "$ref": "#/definitions/bool", + "definitions": { + "bool": false + } + }, + "tests": [ + { + "description": "any value is invalid", + "data": "foo", + "valid": false + } + ] } ]