Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions output-tests/draft2019-09/structure/basic.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
]
}
]
43 changes: 43 additions & 0 deletions output-tests/draft2019-09/structure/detailed.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
]
}
]
42 changes: 42 additions & 0 deletions output-tests/draft2019-09/structure/flag.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
]
}
]
41 changes: 41 additions & 0 deletions output-tests/draft2019-09/structure/verbose.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
]
}
]
53 changes: 53 additions & 0 deletions output-tests/draft2020-12/structure/basic.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
]
}
]
43 changes: 43 additions & 0 deletions output-tests/draft2020-12/structure/detailed.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
]
}
]
42 changes: 42 additions & 0 deletions output-tests/draft2020-12/structure/flag.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
]
}
]
41 changes: 41 additions & 0 deletions output-tests/draft2020-12/structure/verbose.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
]
}
]