Skip to content

Commit 2b536c0

Browse files
committed
Update the test schema to Draft 2020, and fix a bug in it.
`minItems` was placed inside `items` in the root schema, meaning it was not checking that each file contained at least one test case. Now it does, and does so using draft 2020. Also tidied a few descriptions, removed two "dead properties" (id, output) which we added in prep for enriching the suite but haven't yet added concrete examples of. We can re-add when we do add some.
1 parent 1e0ebd2 commit 2b536c0

File tree

1 file changed

+19
-50
lines changed

1 file changed

+19
-50
lines changed

test-schema.json

+19-50
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,57 @@
11
{
2-
"$schema": "http://json-schema.org/draft-06/schema#",
3-
"description": "Schema for tests",
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"description": "A schema for files contained within this suite",
4+
45
"type": "array",
6+
"minItems": 1,
57
"items": {
8+
"description": "An individual test case, containing multiple tests of a single schema's behavior",
9+
610
"type": "object",
711
"required": [ "description", "schema", "tests" ],
812
"properties": {
9-
"id": {
10-
"description": "Uniquely identifies a set of tests",
11-
"type": "string",
12-
"format": "uri"
13-
},
1413
"description": {
15-
"description": "The test set description",
14+
"description": "The test case description",
1615
"type": "string"
1716
},
1817
"comment": {
19-
"description": "Any additional comments about the test set",
18+
"description": "Any additional comments about the test case",
2019
"type": "string"
2120
},
2221
"schema": {
23-
"description": "This should be a valid schema. This should be a ref to a meta-schema if schema keywords need testing."
22+
"description": "A valid JSON Schema (one written for the corresponding version directory that the file sits within)."
2423
},
2524
"tests": {
2625
"description": "A set of related tests all using the same schema",
2726
"type": "array",
28-
"items": { "$ref": "#/definitions/test" },
27+
"items": { "$ref": "#/$defs/test" },
2928
"minItems": 1
3029
}
3130
},
32-
"additionalProperties": false,
33-
"minItems": 1
31+
"additionalProperties": false
3432
},
35-
"definitions": {
36-
"outputItem": {
37-
"type": "object",
38-
"properties": {
39-
"valid": { "type": "boolean" },
40-
"keywordLocation": { "type": "string" },
41-
"absoluteKeywordLocation": {
42-
"type": "string",
43-
"format": "uri"
44-
},
45-
"instanceLocation": { "type": "string" },
46-
"annotations": {
47-
"type": "array",
48-
"items": { "$ref": "#/definitions/outputItem" }
49-
},
50-
"errors": {
51-
"type": "array",
52-
"items": { "$ref": "#/definitions/outputItem" }
53-
}
54-
}
55-
},
33+
34+
"$defs": {
5635
"test": {
5736
"description": "A single test",
37+
5838
"type": "object",
5939
"required": [ "description", "data", "valid" ],
6040
"properties": {
61-
"id": {
62-
"description": "Uniquely identifies a single test",
63-
"type": "string",
64-
"format": "uri"
65-
},
6641
"description": {
67-
"description": "The test description",
42+
"description": "The test description, briefly explaining which behavior it exercises",
6843
"type": "string"
6944
},
7045
"comment": {
7146
"description": "Any additional comments about the test",
7247
"type": "string"
7348
},
7449
"data": {
75-
"description": "This is the instance to be validated against the schema in \"schema\"."
50+
"description": "The instance which should be validated against the schema in \"schema\"."
7651
},
77-
"valid": { "type": "boolean" },
78-
"output": {
79-
"type": "object",
80-
"required": [ "basic", "detailed", "verbose" ],
81-
"properties": {
82-
"basic": { "$ref": "#/definitions/outputItem" },
83-
"detailed": { "$ref": "#/definitions/outputItem" },
84-
"verbose": { "$ref": "#/definitions/outputItem" }
85-
}
52+
"valid": {
53+
"description": "Whether the validation process of this instance should consider the instance valid or not",
54+
"type": "boolean"
8655
}
8756
},
8857
"additionalProperties": false

0 commit comments

Comments
 (0)