Skip to content

Commit 3413863

Browse files
committed
Inline the relevant parts of the test schema to output tests.
Output tests aren't actually overlapping with the normal test schema, they don't contain the 'valid' property (which is required in normal tests).
1 parent dc6e820 commit 3413863

File tree

2 files changed

+58
-27
lines changed

2 files changed

+58
-27
lines changed

output-test-schema.json

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,68 @@
33
"$id": "https://json-schema.org/tests/output-test-schema",
44
"description": "A schema for files contained within this suite",
55

6-
"$ref": "test-schema",
6+
"type": "array",
7+
"minItems": 1,
8+
"items": {
9+
"description": "An individual test case, containing multiple tests of a single schema's behavior",
10+
11+
"type": "object",
12+
"required": [ "description", "schema", "tests" ],
13+
"properties": {
14+
"description": {
15+
"description": "The test case description",
16+
"type": "string"
17+
},
18+
"comment": {
19+
"description": "Any additional comments about the test case",
20+
"type": "string"
21+
},
22+
"schema": {
23+
"description": "A valid JSON Schema (one written for the corresponding version directory that the file sits within)."
24+
},
25+
"tests": {
26+
"description": "A set of related tests all using the same schema",
27+
"type": "array",
28+
"items": { "$ref": "#/$defs/test" },
29+
"minItems": 1
30+
}
31+
},
32+
"additionalProperties": false
33+
},
734

835
"$defs": {
936
"test": {
10-
"$dynamicAnchor": "test",
1137
"description": "A single output test",
1238

13-
"allOf": [
14-
{ "$ref": "test-schema#/$defs/test" },
15-
{
39+
"type": "object",
40+
"required": [ "description", "data", "output" ],
41+
"properties": {
42+
"description": {
43+
"description": "The test description, briefly explaining which behavior it exercises",
44+
"type": "string"
45+
},
46+
"comment": {
47+
"description": "Any additional comments about the test",
48+
"type": "string"
49+
},
50+
"data": {
51+
"description": "The instance which should be validated against the schema in \"schema\"."
52+
},
53+
"output": {
54+
"description": "schemas that are used to verify output",
55+
"type": "object",
1656
"properties": {
17-
"output": {
18-
"description": "schemas that are used to verify output",
19-
"type": "object",
20-
"properties": {
21-
"flag": { "$ref": "https://json-schema.org/draft/2020-12/schema" },
22-
"basic": { "$ref": "https://json-schema.org/draft/2020-12/schema" },
23-
"detailed": { "$ref": "https://json-schema.org/draft/2020-12/schema" },
24-
"verbose": { "$ref": "https://json-schema.org/draft/2020-12/schema" },
25-
"list": { "$ref": "https://json-schema.org/draft/2020-12/schema" },
26-
"hierarchy": { "$ref": "https://json-schema.org/draft/2020-12/schema" }
27-
},
28-
"minProperties": 1,
29-
"additionalProperties": false
30-
}
31-
}
57+
"flag": { "$ref": "https://json-schema.org/draft/2020-12/schema" },
58+
"basic": { "$ref": "https://json-schema.org/draft/2020-12/schema" },
59+
"detailed": { "$ref": "https://json-schema.org/draft/2020-12/schema" },
60+
"verbose": { "$ref": "https://json-schema.org/draft/2020-12/schema" },
61+
"list": { "$ref": "https://json-schema.org/draft/2020-12/schema" },
62+
"hierarchy": { "$ref": "https://json-schema.org/draft/2020-12/schema" }
63+
},
64+
"minProperties": 1,
65+
"additionalProperties": false
3266
}
33-
]
67+
}
3468
}
3569
}
3670
}

test-schema.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
"tests": {
2626
"description": "A set of related tests all using the same schema",
2727
"type": "array",
28-
"items": {
29-
"$dynamicRef": "#test",
30-
"unevaluatedProperties": false
31-
},
28+
"items": { "$ref": "#/$defs/test" },
3229
"minItems": 1
3330
}
3431
},
@@ -37,7 +34,6 @@
3734

3835
"$defs": {
3936
"test": {
40-
"$dynamicAnchor": "test",
4137
"description": "A single test",
4238

4339
"type": "object",
@@ -58,7 +54,8 @@
5854
"description": "Whether the validation process of this instance should consider the instance valid or not",
5955
"type": "boolean"
6056
}
61-
}
57+
},
58+
"additionalProperties": false
6259
}
6360
}
6461
}

0 commit comments

Comments
 (0)