diff --git a/output-tests/draft2019-09/structure/basic.json b/output-tests/draft2019-09/structure/basic.json new file mode 100644 index 00000000..1303272e --- /dev/null +++ b/output-tests/draft2019-09/structure/basic.json @@ -0,0 +1,53 @@ +[ + { + "description": "basic output has valid, errors array, each error has keywordLocation, instanceLocation, valid", + "schema": { + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/tests/structure/draft2019-09/basic/0", + "type": "string", + "anyOf": [true] + }, + "tests": [ + { + "description": "invalid data produces valid: false and errors array", + "data": 1, + "output": { + "basic": { + "$id": "https://json-schema.org/tests/structure/draft2019-09/basic/0/tests/0/basic", + "$ref": "/draft/2019-09/output/schema", + "properties": { + "valid": { "const": false }, + "errors": { + "type": "array", + "minItems": 1, + "items": { + "required": ["keywordLocation", "instanceLocation", "valid"], + "properties": { + "keywordLocation": { "type": "string" }, + "instanceLocation": { "type": "string" }, + "valid": { "type": "boolean" } + } + } + } + }, + "required": ["valid", "errors"] + } + } + }, + { + "description": "valid data produces valid true, no errors or empty", + "data": "hello", + "output": { + "basic": { + "$id": "https://json-schema.org/tests/structure/draft2019-09/basic/0/tests/1/basic", + "$ref": "/draft/2019-09/output/schema", + "properties": { + "valid": { "const": true } + }, + "required": ["valid"] + } + } + } + ] + } +] diff --git a/output-tests/draft2019-09/structure/detailed.json b/output-tests/draft2019-09/structure/detailed.json new file mode 100644 index 00000000..3e1ede99 --- /dev/null +++ b/output-tests/draft2019-09/structure/detailed.json @@ -0,0 +1,43 @@ +[ + { + "description": "detailed output has keywordLocation, instanceLocation, valid, nested errors when invalid", + "schema": { + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/tests/structure/draft2019-09/detailed/0", + "allOf": [ + { "type": "string" }, + { "minLength": 10 } + ] + }, + "tests": [ + { + "description": "invalid data produces nested errors with required fields", + "data": 1, + "output": { + "detailed": { + "$id": "https://json-schema.org/tests/structure/draft2019-09/detailed/0/tests/0/detailed", + "$ref": "/draft/2019-09/output/schema", + "properties": { + "keywordLocation": { "type": "string" }, + "instanceLocation": { "type": "string" }, + "valid": { "const": false }, + "errors": { + "type": "array", + "minItems": 1, + "items": { + "required": ["keywordLocation", "instanceLocation", "valid"], + "properties": { + "keywordLocation": { "type": "string" }, + "instanceLocation": { "type": "string" }, + "valid": { "type": "boolean" } + } + } + } + }, + "required": ["keywordLocation", "instanceLocation", "valid", "errors"] + } + } + } + ] + } +] diff --git a/output-tests/draft2019-09/structure/flag.json b/output-tests/draft2019-09/structure/flag.json new file mode 100644 index 00000000..a177bfe0 --- /dev/null +++ b/output-tests/draft2019-09/structure/flag.json @@ -0,0 +1,42 @@ +[ + { + "description": "flag output has only valid key, no extra keys", + "schema": { + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/tests/structure/draft2019-09/flag/0", + "type": "string" + }, + "tests": [ + { + "description": "valid schema and valid data produces only valid true", + "data": "hello", + "output": { + "flag": { + "$id": "https://json-schema.org/tests/structure/draft2019-09/flag/0/tests/0/flag", + "$ref": "/draft/2019-09/output/schema", + "properties": { + "valid": { "const": true } + }, + "required": ["valid"], + "additionalProperties": false + } + } + }, + { + "description": "valid schema and invalid data produces only valid false", + "data": 1, + "output": { + "flag": { + "$id": "https://json-schema.org/tests/structure/draft2019-09/flag/0/tests/1/flag", + "$ref": "/draft/2019-09/output/schema", + "properties": { + "valid": { "const": false } + }, + "required": ["valid"], + "additionalProperties": false + } + } + } + ] + } +] diff --git a/output-tests/draft2019-09/structure/verbose.json b/output-tests/draft2019-09/structure/verbose.json new file mode 100644 index 00000000..ee75e146 --- /dev/null +++ b/output-tests/draft2019-09/structure/verbose.json @@ -0,0 +1,41 @@ +[ + { + "description": "verbose output includes every evaluated keyword, annotations for passing keywords", + "schema": { + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/tests/structure/draft2019-09/verbose/0", + "type": "object", + "properties": { + "name": { "type": "string" } + } + }, + "tests": [ + { + "description": "valid data produces annotations for type and properties keywords", + "data": { "name": "test" }, + "output": { + "verbose": { + "$id": "https://json-schema.org/tests/structure/draft2019-09/verbose/0/tests/0/verbose", + "$ref": "/draft/2019-09/output/schema", + "properties": { + "valid": { "const": true }, + "annotations": { + "type": "array", + "minItems": 1, + "items": { + "required": ["keywordLocation", "instanceLocation", "valid"], + "properties": { + "keywordLocation": { "type": "string" }, + "instanceLocation": { "type": "string" }, + "valid": { "type": "boolean" } + } + } + } + }, + "required": ["valid", "annotations"] + } + } + } + ] + } +] diff --git a/output-tests/draft2020-12/structure/basic.json b/output-tests/draft2020-12/structure/basic.json new file mode 100644 index 00000000..8d1d9909 --- /dev/null +++ b/output-tests/draft2020-12/structure/basic.json @@ -0,0 +1,53 @@ +[ + { + "description": "basic output has valid, errors array, each error has keywordLocation, instanceLocation, valid", + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/tests/structure/draft2020-12/basic/0", + "type": "string", + "anyOf": [true] + }, + "tests": [ + { + "description": "invalid data produces valid: false and errors array", + "data": 1, + "output": { + "basic": { + "$id": "https://json-schema.org/tests/structure/draft2020-12/basic/0/tests/0/basic", + "$ref": "/draft/2020-12/output/schema", + "properties": { + "valid": { "const": false }, + "errors": { + "type": "array", + "minItems": 1, + "items": { + "required": ["keywordLocation", "instanceLocation", "valid"], + "properties": { + "keywordLocation": { "type": "string" }, + "instanceLocation": { "type": "string" }, + "valid": { "type": "boolean" } + } + } + } + }, + "required": ["valid", "errors"] + } + } + }, + { + "description": "valid data produces valid true, no errors or empty", + "data": "hello", + "output": { + "basic": { + "$id": "https://json-schema.org/tests/structure/draft2020-12/basic/0/tests/1/basic", + "$ref": "/draft/2020-12/output/schema", + "properties": { + "valid": { "const": true } + }, + "required": ["valid"] + } + } + } + ] + } +] diff --git a/output-tests/draft2020-12/structure/detailed.json b/output-tests/draft2020-12/structure/detailed.json new file mode 100644 index 00000000..0bf84aa8 --- /dev/null +++ b/output-tests/draft2020-12/structure/detailed.json @@ -0,0 +1,43 @@ +[ + { + "description": "detailed output has keywordLocation, instanceLocation, valid, nested errors when invalid", + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/tests/structure/draft2020-12/detailed/0", + "allOf": [ + { "type": "string" }, + { "minLength": 10 } + ] + }, + "tests": [ + { + "description": "invalid data produces nested errors with required fields", + "data": 1, + "output": { + "detailed": { + "$id": "https://json-schema.org/tests/structure/draft2020-12/detailed/0/tests/0/detailed", + "$ref": "/draft/2020-12/output/schema", + "properties": { + "keywordLocation": { "type": "string" }, + "instanceLocation": { "type": "string" }, + "valid": { "const": false }, + "errors": { + "type": "array", + "minItems": 1, + "items": { + "required": ["keywordLocation", "instanceLocation", "valid"], + "properties": { + "keywordLocation": { "type": "string" }, + "instanceLocation": { "type": "string" }, + "valid": { "type": "boolean" } + } + } + } + }, + "required": ["keywordLocation", "instanceLocation", "valid", "errors"] + } + } + } + ] + } +] diff --git a/output-tests/draft2020-12/structure/flag.json b/output-tests/draft2020-12/structure/flag.json new file mode 100644 index 00000000..eaf15b83 --- /dev/null +++ b/output-tests/draft2020-12/structure/flag.json @@ -0,0 +1,42 @@ +[ + { + "description": "flag output has only valid key, no extra keys", + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/tests/structure/draft2020-12/flag/0", + "type": "string" + }, + "tests": [ + { + "description": "valid schema and valid data produces only valid true", + "data": "hello", + "output": { + "flag": { + "$id": "https://json-schema.org/tests/structure/draft2020-12/flag/0/tests/0/flag", + "$ref": "/draft/2020-12/output/schema", + "properties": { + "valid": { "const": true } + }, + "required": ["valid"], + "additionalProperties": false + } + } + }, + { + "description": "valid schema and invalid data produces only valid false", + "data": 1, + "output": { + "flag": { + "$id": "https://json-schema.org/tests/structure/draft2020-12/flag/0/tests/1/flag", + "$ref": "/draft/2020-12/output/schema", + "properties": { + "valid": { "const": false } + }, + "required": ["valid"], + "additionalProperties": false + } + } + } + ] + } +] diff --git a/output-tests/draft2020-12/structure/verbose.json b/output-tests/draft2020-12/structure/verbose.json new file mode 100644 index 00000000..4cdc2409 --- /dev/null +++ b/output-tests/draft2020-12/structure/verbose.json @@ -0,0 +1,41 @@ +[ + { + "description": "verbose output includes every evaluated keyword, annotations for passing keywords", + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/tests/structure/draft2020-12/verbose/0", + "type": "object", + "properties": { + "name": { "type": "string" } + } + }, + "tests": [ + { + "description": "valid data produces annotations for type and properties keywords", + "data": { "name": "test" }, + "output": { + "verbose": { + "$id": "https://json-schema.org/tests/structure/draft2020-12/verbose/0/tests/0/verbose", + "$ref": "/draft/2020-12/output/schema", + "properties": { + "valid": { "const": true }, + "annotations": { + "type": "array", + "minItems": 1, + "items": { + "required": ["keywordLocation", "instanceLocation", "valid"], + "properties": { + "keywordLocation": { "type": "string" }, + "instanceLocation": { "type": "string" }, + "valid": { "type": "boolean" } + } + } + } + }, + "required": ["valid", "annotations"] + } + } + } + ] + } +]