Skip to content

Commit d2980e4

Browse files
committed
Allow optional id property on tests in test-schema
1 parent 44fc7b2 commit d2980e4

File tree

1 file changed

+114
-110
lines changed

1 file changed

+114
-110
lines changed

test-schema.json

Lines changed: 114 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,128 @@
11
{
2-
"$schema": "https://json-schema.org/draft/2020-12/schema",
3-
"$id": "https://json-schema.org/tests/test-schema",
4-
"description": "A schema for files contained within this suite",
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://json-schema.org/tests/test-schema",
4+
"description": "A schema for files contained within this suite",
55

6-
"type": "array",
7-
"minItems": 1,
8-
"items": {
9-
"description": "An individual test case, containing multiple tests of a single schema's behavior",
6+
"type": "array",
7+
"minItems": 1,
8+
"items": {
9+
"description": "An individual test case, containing multiple tests of a single schema's behavior",
1010

11-
"type": "object",
12-
"required": [ "description", "schema", "tests" ],
13-
"properties": {
14-
"description": {
15-
"description": "The test case description",
16-
"type": "string"
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+
"specification": {
32+
"description": "A reference to a specification document which defines the behavior tested by this test case. Typically this should be a JSON Schema specification document, though in cases where the JSON Schema specification points to another RFC it should contain *both* the portion of the JSON Schema specification which indicates what RFC (and section) to follow as *well* as information on where in that specification the behavior is specified.",
33+
34+
"type": "array",
35+
"minItems": 1,
36+
"uniqueItems": true,
37+
"items": {
38+
"properties": {
39+
"core": {
40+
"description": "A section in official JSON Schema core drafts",
41+
"url": "https://json-schema.org/specification-links",
42+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
43+
"type": "string"
1744
},
18-
"comment": {
19-
"description": "Any additional comments about the test case",
20-
"type": "string"
45+
"validation": {
46+
"description": "A section in official JSON Schema validation drafts",
47+
"url": "https://json-schema.org/specification-links",
48+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
49+
"type": "string"
2150
},
22-
"schema": {
23-
"description": "A valid JSON Schema (one written for the corresponding version directory that the file sits within)."
51+
"ecma262": {
52+
"description": "A section in official ECMA 262 specification for defining regular expressions",
53+
"url": "https://262.ecma-international.org/",
54+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
55+
"type": "string"
2456
},
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
57+
"perl5": {
58+
"description": "A section name in Perl documentation for defining regular expressions",
59+
"url": "https://perldoc.perl.org/perlre",
60+
"type": "string"
3061
},
31-
"specification":{
32-
"description": "A reference to a specification document which defines the behavior tested by this test case. Typically this should be a JSON Schema specification document, though in cases where the JSON Schema specification points to another RFC it should contain *both* the portion of the JSON Schema specification which indicates what RFC (and section) to follow as *well* as information on where in that specification the behavior is specified.",
33-
34-
"type": "array",
35-
"minItems": 1,
36-
"uniqueItems": true,
37-
"items":{
38-
"properties": {
39-
"core": {
40-
"description": "A section in official JSON Schema core drafts",
41-
"url": "https://json-schema.org/specification-links",
42-
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
43-
"type":"string"
44-
},
45-
"validation": {
46-
"description": "A section in official JSON Schema validation drafts",
47-
"url": "https://json-schema.org/specification-links",
48-
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
49-
"type":"string"
50-
},
51-
"ecma262": {
52-
"description": "A section in official ECMA 262 specification for defining regular expressions",
53-
"url": "https://262.ecma-international.org/",
54-
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
55-
"type":"string"
56-
},
57-
"perl5": {
58-
"description": "A section name in Perl documentation for defining regular expressions",
59-
"url": "https://perldoc.perl.org/perlre",
60-
"type":"string"
61-
},
62-
"quote": {
63-
"description": "Quote describing the test case",
64-
"type":"string"
65-
}
66-
},
67-
"patternProperties": {
68-
"^rfc\\d+$": {
69-
"description": "A section in official RFC for the given rfc number",
70-
"url": "https://www.rfc-editor.org/",
71-
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
72-
"type":"string"
73-
},
74-
"^iso\\d+$": {
75-
"description": "A section in official ISO for the given iso number",
76-
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
77-
"type": "string"
78-
}
79-
},
80-
"additionalProperties": { "type": "string" },
81-
"minProperties": 1,
82-
"propertyNames": {
83-
"oneOf": [
84-
{
85-
"pattern": "^((iso)|(rfc))[0-9]+$"
86-
},
87-
{
88-
"enum": [ "core", "validation", "ecma262", "perl5", "quote" ]
89-
}
90-
]
91-
}
92-
}
62+
"quote": {
63+
"description": "Quote describing the test case",
64+
"type": "string"
9365
}
94-
},
95-
"additionalProperties": false
66+
},
67+
"patternProperties": {
68+
"^rfc\\d+$": {
69+
"description": "A section in official RFC for the given rfc number",
70+
"url": "https://www.rfc-editor.org/",
71+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
72+
"type": "string"
73+
},
74+
"^iso\\d+$": {
75+
"description": "A section in official ISO for the given iso number",
76+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
77+
"type": "string"
78+
}
79+
},
80+
"additionalProperties": { "type": "string" },
81+
"minProperties": 1,
82+
"propertyNames": {
83+
"oneOf": [
84+
{
85+
"pattern": "^((iso)|(rfc))[0-9]+$"
86+
},
87+
{
88+
"enum": ["core", "validation", "ecma262", "perl5", "quote"]
89+
}
90+
]
91+
}
92+
}
93+
}
9694
},
95+
"additionalProperties": false
96+
},
9797

98-
"$defs": {
99-
"test": {
100-
"description": "A single test",
98+
"$defs": {
99+
"test": {
100+
"description": "A single test",
101101

102-
"type": "object",
103-
"required": [ "description", "data", "valid" ],
104-
"properties": {
105-
"description": {
106-
"description": "The test description, briefly explaining which behavior it exercises",
107-
"type": "string"
108-
},
109-
"comment": {
110-
"description": "Any additional comments about the test",
111-
"type": "string"
112-
},
113-
"data": {
114-
"description": "The instance which should be validated against the schema in \"schema\"."
115-
},
116-
"valid": {
117-
"description": "Whether the validation process of this instance should consider the instance valid or not",
118-
"type": "boolean"
119-
}
120-
},
121-
"additionalProperties": false
102+
"type": "object",
103+
"required": ["description", "data", "valid"],
104+
"properties": {
105+
"description": {
106+
"description": "The test description, briefly explaining which behavior it exercises",
107+
"type": "string"
108+
},
109+
"comment": {
110+
"description": "Any additional comments about the test",
111+
"type": "string"
112+
},
113+
"data": {
114+
"description": "The instance which should be validated against the schema in \"schema\"."
115+
},
116+
"valid": {
117+
"description": "Whether the validation process of this instance should consider the instance valid or not",
118+
"type": "boolean"
119+
},
120+
"id": {
121+
"description": "Stable identifier for this test",
122+
"type": "string"
122123
}
124+
},
125+
"additionalProperties": false
123126
}
127+
}
124128
}

0 commit comments

Comments
 (0)