Skip to content

Commit

Permalink
Squashed 'json/' changes from 39d1d24d..1047a1aa
Browse files Browse the repository at this point in the history
1047a1aa Merge pull request #565 from json-schema-org/update-test-schema
7967a87b Merge pull request #566 from json-schema-org/tidy-unevaluatedItems
b45a7878 Remove unnecessary type validation from unevaluatedItems tests.
2b536c02 Update the test schema to Draft 2020, and fix a bug in it.

git-subtree-dir: json
git-subtree-split: 1047a1aa225bab43c50978555a990bfff81f6023
  • Loading branch information
Julian committed Jun 30, 2022
1 parent 09edc31 commit cfff411
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 165 deletions.
69 changes: 19 additions & 50 deletions test-schema.json
Original file line number Diff line number Diff line change
@@ -1,88 +1,57 @@
{
"$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": {
"description": "Any additional comments about the test",
"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
Expand Down
44 changes: 7 additions & 37 deletions tests/draft-next/unevaluatedItems.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
[
{
"description": "unevaluatedItems true",
"schema": {
"type": "array",
"unevaluatedItems": true
},
"schema": { "unevaluatedItems": true },
"tests": [
{
"description": "with no unevaluated items",
Expand All @@ -20,10 +17,7 @@
},
{
"description": "unevaluatedItems false",
"schema": {
"type": "array",
"unevaluatedItems": false
},
"schema": { "unevaluatedItems": false },
"tests": [
{
"description": "with no unevaluated items",
Expand All @@ -39,10 +33,7 @@
},
{
"description": "unevaluatedItems as schema",
"schema": {
"type": "array",
"unevaluatedItems": { "type": "string" }
},
"schema": { "unevaluatedItems": { "type": "string" } },
"tests": [
{
"description": "with no unevaluated items",
Expand All @@ -64,7 +55,6 @@
{
"description": "unevaluatedItems with uniform items",
"schema": {
"type": "array",
"items": { "type": "string" },
"unevaluatedItems": false
},
Expand All @@ -79,7 +69,6 @@
{
"description": "unevaluatedItems with tuple",
"schema": {
"type": "array",
"prefixItems": [
{ "type": "string" }
],
Expand All @@ -101,7 +90,6 @@
{
"description": "unevaluatedItems with items",
"schema": {
"type": "array",
"prefixItems": [
{ "type": "string" }
],
Expand All @@ -119,7 +107,6 @@
{
"description": "unevaluatedItems with nested tuple",
"schema": {
"type": "array",
"prefixItems": [
{ "type": "string" }
],
Expand Down Expand Up @@ -202,16 +189,13 @@
{
"description": "unevaluatedItems with nested unevaluatedItems",
"schema": {
"type": "array",
"allOf": [
{
"prefixItems": [
{ "type": "string" }
]
},
{
"unevaluatedItems": true
}
{ "unevaluatedItems": true }
],
"unevaluatedItems": false
},
Expand All @@ -231,7 +215,6 @@
{
"description": "unevaluatedItems with anyOf",
"schema": {
"type": "array",
"prefixItems": [
{ "const": "foo" }
],
Expand Down Expand Up @@ -278,7 +261,6 @@
{
"description": "unevaluatedItems with oneOf",
"schema": {
"type": "array",
"prefixItems": [
{ "const": "foo" }
],
Expand Down Expand Up @@ -314,7 +296,6 @@
{
"description": "unevaluatedItems with not",
"schema": {
"type": "array",
"prefixItems": [
{ "const": "foo" }
],
Expand All @@ -339,7 +320,6 @@
{
"description": "unevaluatedItems with if/then/else",
"schema": {
"type": "array",
"prefixItems": [
{ "const": "foo" }
],
Expand Down Expand Up @@ -392,7 +372,6 @@
{
"description": "unevaluatedItems with boolean schemas",
"schema": {
"type": "array",
"allOf": [true],
"unevaluatedItems": false
},
Expand All @@ -412,7 +391,6 @@
{
"description": "unevaluatedItems with $ref",
"schema": {
"type": "array",
"$ref": "#/$defs/bar",
"prefixItems": [
{ "type": "string" }
Expand Down Expand Up @@ -447,9 +425,7 @@
{
"prefixItems": [ true ]
},
{
"unevaluatedItems": false
}
{ "unevaluatedItems": false }
]
},
"tests": [
Expand All @@ -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
}
Expand All @@ -481,9 +453,7 @@
"foo": {
"prefixItems": [
true,
{
"type": "string"
}
{ "type": "string" }
]
}
}
Expand Down
Loading

0 comments on commit cfff411

Please sign in to comment.