diff --git a/test-schema.json b/test-schema.json index 11b1e8d88..5d250317b 100644 --- a/test-schema.json +++ b/test-schema.json @@ -1,70 +1,45 @@ { - "$schema": "http://json-schema.org/draft-06/schema#", - "description": "Schema for tests", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "A schema for files contained within this suite", + "type": "array", + "minItems": 1, "items": { + "description": "An individual test case, containing multiple tests of a single schema's behavior", + "type": "object", "required": [ "description", "schema", "tests" ], "properties": { - "id": { - "description": "Uniquely identifies a set of tests", - "type": "string", - "format": "uri" - }, "description": { - "description": "The test set description", + "description": "The test case description", "type": "string" }, "comment": { - "description": "Any additional comments about the test set", + "description": "Any additional comments about the test case", "type": "string" }, "schema": { - "description": "This should be a valid schema. This should be a ref to a meta-schema if schema keywords need testing." + "description": "A valid JSON Schema (one written for the corresponding version directory that the file sits within)." }, "tests": { "description": "A set of related tests all using the same schema", "type": "array", - "items": { "$ref": "#/definitions/test" }, + "items": { "$ref": "#/$defs/test" }, "minItems": 1 } }, - "additionalProperties": false, - "minItems": 1 + "additionalProperties": false }, - "definitions": { - "outputItem": { - "type": "object", - "properties": { - "valid": { "type": "boolean" }, - "keywordLocation": { "type": "string" }, - "absoluteKeywordLocation": { - "type": "string", - "format": "uri" - }, - "instanceLocation": { "type": "string" }, - "annotations": { - "type": "array", - "items": { "$ref": "#/definitions/outputItem" } - }, - "errors": { - "type": "array", - "items": { "$ref": "#/definitions/outputItem" } - } - } - }, + + "$defs": { "test": { "description": "A single test", + "type": "object", "required": [ "description", "data", "valid" ], "properties": { - "id": { - "description": "Uniquely identifies a single test", - "type": "string", - "format": "uri" - }, "description": { - "description": "The test description", + "description": "The test description, briefly explaining which behavior it exercises", "type": "string" }, "comment": { @@ -72,17 +47,11 @@ "type": "string" }, "data": { - "description": "This is the instance to be validated against the schema in \"schema\"." + "description": "The instance which should be validated against the schema in \"schema\"." }, - "valid": { "type": "boolean" }, - "output": { - "type": "object", - "required": [ "basic", "detailed", "verbose" ], - "properties": { - "basic": { "$ref": "#/definitions/outputItem" }, - "detailed": { "$ref": "#/definitions/outputItem" }, - "verbose": { "$ref": "#/definitions/outputItem" } - } + "valid": { + "description": "Whether the validation process of this instance should consider the instance valid or not", + "type": "boolean" } }, "additionalProperties": false diff --git a/tests/draft-next/unevaluatedItems.json b/tests/draft-next/unevaluatedItems.json index d113ea64e..fbd4b48a4 100644 --- a/tests/draft-next/unevaluatedItems.json +++ b/tests/draft-next/unevaluatedItems.json @@ -1,10 +1,7 @@ [ { "description": "unevaluatedItems true", - "schema": { - "type": "array", - "unevaluatedItems": true - }, + "schema": { "unevaluatedItems": true }, "tests": [ { "description": "with no unevaluated items", @@ -20,10 +17,7 @@ }, { "description": "unevaluatedItems false", - "schema": { - "type": "array", - "unevaluatedItems": false - }, + "schema": { "unevaluatedItems": false }, "tests": [ { "description": "with no unevaluated items", @@ -39,10 +33,7 @@ }, { "description": "unevaluatedItems as schema", - "schema": { - "type": "array", - "unevaluatedItems": { "type": "string" } - }, + "schema": { "unevaluatedItems": { "type": "string" } }, "tests": [ { "description": "with no unevaluated items", @@ -64,7 +55,6 @@ { "description": "unevaluatedItems with uniform items", "schema": { - "type": "array", "items": { "type": "string" }, "unevaluatedItems": false }, @@ -79,7 +69,6 @@ { "description": "unevaluatedItems with tuple", "schema": { - "type": "array", "prefixItems": [ { "type": "string" } ], @@ -101,7 +90,6 @@ { "description": "unevaluatedItems with items", "schema": { - "type": "array", "prefixItems": [ { "type": "string" } ], @@ -119,7 +107,6 @@ { "description": "unevaluatedItems with nested tuple", "schema": { - "type": "array", "prefixItems": [ { "type": "string" } ], @@ -202,16 +189,13 @@ { "description": "unevaluatedItems with nested unevaluatedItems", "schema": { - "type": "array", "allOf": [ { "prefixItems": [ { "type": "string" } ] }, - { - "unevaluatedItems": true - } + { "unevaluatedItems": true } ], "unevaluatedItems": false }, @@ -231,7 +215,6 @@ { "description": "unevaluatedItems with anyOf", "schema": { - "type": "array", "prefixItems": [ { "const": "foo" } ], @@ -278,7 +261,6 @@ { "description": "unevaluatedItems with oneOf", "schema": { - "type": "array", "prefixItems": [ { "const": "foo" } ], @@ -314,7 +296,6 @@ { "description": "unevaluatedItems with not", "schema": { - "type": "array", "prefixItems": [ { "const": "foo" } ], @@ -339,7 +320,6 @@ { "description": "unevaluatedItems with if/then/else", "schema": { - "type": "array", "prefixItems": [ { "const": "foo" } ], @@ -392,7 +372,6 @@ { "description": "unevaluatedItems with boolean schemas", "schema": { - "type": "array", "allOf": [true], "unevaluatedItems": false }, @@ -412,7 +391,6 @@ { "description": "unevaluatedItems with $ref", "schema": { - "type": "array", "$ref": "#/$defs/bar", "prefixItems": [ { "type": "string" } @@ -447,9 +425,7 @@ { "prefixItems": [ true ] }, - { - "unevaluatedItems": false - } + { "unevaluatedItems": false } ] }, "tests": [ @@ -463,14 +439,10 @@ { "description": "item is evaluated in an uncle schema to unevaluatedItems", "schema": { - "type": "object", "properties": { "foo": { - "type": "array", "prefixItems": [ - { - "type": "string" - } + { "type": "string" } ], "unevaluatedItems": false } @@ -481,9 +453,7 @@ "foo": { "prefixItems": [ true, - { - "type": "string" - } + { "type": "string" } ] } } diff --git a/tests/draft2019-09/unevaluatedItems.json b/tests/draft2019-09/unevaluatedItems.json index 87ce2a988..b084986b6 100644 --- a/tests/draft2019-09/unevaluatedItems.json +++ b/tests/draft2019-09/unevaluatedItems.json @@ -1,10 +1,7 @@ [ { "description": "unevaluatedItems true", - "schema": { - "type": "array", - "unevaluatedItems": true - }, + "schema": { "unevaluatedItems": true }, "tests": [ { "description": "with no unevaluated items", @@ -20,10 +17,7 @@ }, { "description": "unevaluatedItems false", - "schema": { - "type": "array", - "unevaluatedItems": false - }, + "schema": { "unevaluatedItems": false }, "tests": [ { "description": "with no unevaluated items", @@ -39,10 +33,7 @@ }, { "description": "unevaluatedItems as schema", - "schema": { - "type": "array", - "unevaluatedItems": { "type": "string" } - }, + "schema": { "unevaluatedItems": { "type": "string" } }, "tests": [ { "description": "with no unevaluated items", @@ -64,7 +55,6 @@ { "description": "unevaluatedItems with uniform items", "schema": { - "type": "array", "items": { "type": "string" }, "unevaluatedItems": false }, @@ -79,7 +69,6 @@ { "description": "unevaluatedItems with tuple", "schema": { - "type": "array", "items": [ { "type": "string" } ], @@ -101,7 +90,6 @@ { "description": "unevaluatedItems with additionalItems", "schema": { - "type": "array", "items": [ { "type": "string" } ], @@ -119,7 +107,6 @@ { "description": "unevaluatedItems with nested tuple", "schema": { - "type": "array", "items": [ { "type": "string" } ], @@ -176,7 +163,6 @@ { "description": "unevaluatedItems with nested items and additionalItems", "schema": { - "type": "array", "allOf": [ { "items": [ @@ -203,16 +189,13 @@ { "description": "unevaluatedItems with nested unevaluatedItems", "schema": { - "type": "array", "allOf": [ { "items": [ { "type": "string" } ] }, - { - "unevaluatedItems": true - } + { "unevaluatedItems": true } ], "unevaluatedItems": false }, @@ -232,7 +215,6 @@ { "description": "unevaluatedItems with anyOf", "schema": { - "type": "array", "items": [ { "const": "foo" } ], @@ -279,7 +261,6 @@ { "description": "unevaluatedItems with oneOf", "schema": { - "type": "array", "items": [ { "const": "foo" } ], @@ -315,7 +296,6 @@ { "description": "unevaluatedItems with not", "schema": { - "type": "array", "items": [ { "const": "foo" } ], @@ -340,10 +320,7 @@ { "description": "unevaluatedItems with if/then/else", "schema": { - "type": "array", - "items": [ - { "const": "foo" } - ], + "items": [ { "const": "foo" } ], "if": { "items": [ true, @@ -393,7 +370,6 @@ { "description": "unevaluatedItems with boolean schemas", "schema": { - "type": "array", "allOf": [true], "unevaluatedItems": false }, @@ -413,7 +389,6 @@ { "description": "unevaluatedItems with $ref", "schema": { - "type": "array", "$ref": "#/$defs/bar", "items": [ { "type": "string" } @@ -448,9 +423,7 @@ { "items": [ true ] }, - { - "unevaluatedItems": false - } + { "unevaluatedItems": false } ] }, "tests": [ @@ -464,14 +437,10 @@ { "description": "item is evaluated in an uncle schema to unevaluatedItems", "schema": { - "type": "object", "properties": { "foo": { - "type": "array", "items": [ - { - "type": "string" - } + { "type": "string" } ], "unevaluatedItems": false } @@ -482,9 +451,7 @@ "foo": { "items": [ true, - { - "type": "string" - } + { "type": "string" } ] } } diff --git a/tests/draft2020-12/unevaluatedItems.json b/tests/draft2020-12/unevaluatedItems.json index d113ea64e..fbd4b48a4 100644 --- a/tests/draft2020-12/unevaluatedItems.json +++ b/tests/draft2020-12/unevaluatedItems.json @@ -1,10 +1,7 @@ [ { "description": "unevaluatedItems true", - "schema": { - "type": "array", - "unevaluatedItems": true - }, + "schema": { "unevaluatedItems": true }, "tests": [ { "description": "with no unevaluated items", @@ -20,10 +17,7 @@ }, { "description": "unevaluatedItems false", - "schema": { - "type": "array", - "unevaluatedItems": false - }, + "schema": { "unevaluatedItems": false }, "tests": [ { "description": "with no unevaluated items", @@ -39,10 +33,7 @@ }, { "description": "unevaluatedItems as schema", - "schema": { - "type": "array", - "unevaluatedItems": { "type": "string" } - }, + "schema": { "unevaluatedItems": { "type": "string" } }, "tests": [ { "description": "with no unevaluated items", @@ -64,7 +55,6 @@ { "description": "unevaluatedItems with uniform items", "schema": { - "type": "array", "items": { "type": "string" }, "unevaluatedItems": false }, @@ -79,7 +69,6 @@ { "description": "unevaluatedItems with tuple", "schema": { - "type": "array", "prefixItems": [ { "type": "string" } ], @@ -101,7 +90,6 @@ { "description": "unevaluatedItems with items", "schema": { - "type": "array", "prefixItems": [ { "type": "string" } ], @@ -119,7 +107,6 @@ { "description": "unevaluatedItems with nested tuple", "schema": { - "type": "array", "prefixItems": [ { "type": "string" } ], @@ -202,16 +189,13 @@ { "description": "unevaluatedItems with nested unevaluatedItems", "schema": { - "type": "array", "allOf": [ { "prefixItems": [ { "type": "string" } ] }, - { - "unevaluatedItems": true - } + { "unevaluatedItems": true } ], "unevaluatedItems": false }, @@ -231,7 +215,6 @@ { "description": "unevaluatedItems with anyOf", "schema": { - "type": "array", "prefixItems": [ { "const": "foo" } ], @@ -278,7 +261,6 @@ { "description": "unevaluatedItems with oneOf", "schema": { - "type": "array", "prefixItems": [ { "const": "foo" } ], @@ -314,7 +296,6 @@ { "description": "unevaluatedItems with not", "schema": { - "type": "array", "prefixItems": [ { "const": "foo" } ], @@ -339,7 +320,6 @@ { "description": "unevaluatedItems with if/then/else", "schema": { - "type": "array", "prefixItems": [ { "const": "foo" } ], @@ -392,7 +372,6 @@ { "description": "unevaluatedItems with boolean schemas", "schema": { - "type": "array", "allOf": [true], "unevaluatedItems": false }, @@ -412,7 +391,6 @@ { "description": "unevaluatedItems with $ref", "schema": { - "type": "array", "$ref": "#/$defs/bar", "prefixItems": [ { "type": "string" } @@ -447,9 +425,7 @@ { "prefixItems": [ true ] }, - { - "unevaluatedItems": false - } + { "unevaluatedItems": false } ] }, "tests": [ @@ -463,14 +439,10 @@ { "description": "item is evaluated in an uncle schema to unevaluatedItems", "schema": { - "type": "object", "properties": { "foo": { - "type": "array", "prefixItems": [ - { - "type": "string" - } + { "type": "string" } ], "unevaluatedItems": false } @@ -481,9 +453,7 @@ "foo": { "prefixItems": [ true, - { - "type": "string" - } + { "type": "string" } ] } }