Skip to content

Commit 43ca443

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 a "dead property" (id) which we added in prep for adding IDs to test cases but can revisit if/when we get to that.
1 parent 1e0ebd2 commit 43ca443

File tree

1 file changed

+41
-40
lines changed

1 file changed

+41
-40
lines changed

test-schema.json

+41-40
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
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",
@@ -29,53 +28,34 @@
2928
"minItems": 1
3029
}
3130
},
32-
"additionalProperties": false,
33-
"minItems": 1
31+
"additionalProperties": false
3432
},
33+
3534
"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-
},
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\"."
51+
},
52+
"valid": {
53+
"description": "Whether the validation process of this instance should consider the instance valid or not",
54+
"type": "boolean"
7655
},
77-
"valid": { "type": "boolean" },
7856
"output": {
57+
"description": "Reserved for use with the JSON Schema output format",
58+
7959
"type": "object",
8060
"required": [ "basic", "detailed", "verbose" ],
8161
"properties": {
@@ -86,6 +66,27 @@
8666
}
8767
},
8868
"additionalProperties": false
69+
},
70+
71+
"outputItem": {
72+
"type": "object",
73+
"properties": {
74+
"valid": { "type": "boolean" },
75+
"keywordLocation": { "type": "string" },
76+
"absoluteKeywordLocation": {
77+
"type": "string",
78+
"format": "uri"
79+
},
80+
"instanceLocation": { "type": "string" },
81+
"annotations": {
82+
"type": "array",
83+
"items": { "$ref": "#/definitions/outputItem" }
84+
},
85+
"errors": {
86+
"type": "array",
87+
"items": { "$ref": "#/definitions/outputItem" }
88+
}
89+
}
8990
}
9091
}
9192
}

0 commit comments

Comments
 (0)