Skip to content

Commit b50e30b

Browse files
committed
Move tests with ids in non-schemas to optional
1 parent 0433a2b commit b50e30b

File tree

20 files changed

+531
-519
lines changed

20 files changed

+531
-519
lines changed

tests/draft-next/anchor.json

-90
Original file line numberDiff line numberDiff line change
@@ -81,64 +81,6 @@
8181
}
8282
]
8383
},
84-
{
85-
"description": "$anchor inside an enum is not a real identifier",
86-
"comment": "the implementation must not be confused by an $anchor buried in the enum",
87-
"schema": {
88-
"$schema": "https://json-schema.org/draft/next/schema",
89-
"$defs": {
90-
"anchor_in_enum": {
91-
"enum": [
92-
{
93-
"$anchor": "my_anchor",
94-
"type": "null"
95-
}
96-
]
97-
},
98-
"real_identifier_in_schema": {
99-
"$anchor": "my_anchor",
100-
"type": "string"
101-
},
102-
"zzz_anchor_in_const": {
103-
"const": {
104-
"$anchor": "my_anchor",
105-
"type": "null"
106-
}
107-
}
108-
},
109-
"anyOf": [
110-
{ "$ref": "#/$defs/anchor_in_enum" },
111-
{ "$ref": "#my_anchor" }
112-
]
113-
},
114-
"tests": [
115-
{
116-
"description": "exact match to enum, and type matches",
117-
"data": {
118-
"$anchor": "my_anchor",
119-
"type": "null"
120-
},
121-
"valid": true
122-
},
123-
{
124-
"description": "in implementations that strip $anchor, this may match either $def",
125-
"data": {
126-
"type": "null"
127-
},
128-
"valid": false
129-
},
130-
{
131-
"description": "match $ref to $anchor",
132-
"data": "a string to match #/$defs/anchor_in_enum",
133-
"valid": true
134-
},
135-
{
136-
"description": "no match on enum or $ref to $anchor",
137-
"data": 1,
138-
"valid": false
139-
}
140-
]
141-
},
14284
{
14385
"description": "same $anchor with different base uri",
14486
"schema": {
@@ -175,38 +117,6 @@
175117
}
176118
]
177119
},
178-
{
179-
"description": "non-schema object containing an $anchor property",
180-
"schema": {
181-
"$schema": "https://json-schema.org/draft/next/schema",
182-
"$defs": {
183-
"const_not_anchor": {
184-
"const": {
185-
"$anchor": "not_a_real_anchor"
186-
}
187-
}
188-
},
189-
"if": {
190-
"const": "skip not_a_real_anchor"
191-
},
192-
"then": true,
193-
"else" : {
194-
"$ref": "#/$defs/const_not_anchor"
195-
}
196-
},
197-
"tests": [
198-
{
199-
"description": "skip traversing definition for a valid result",
200-
"data": "skip not_a_real_anchor",
201-
"valid": true
202-
},
203-
{
204-
"description": "const at const_not_anchor does not match",
205-
"data": 1,
206-
"valid": false
207-
}
208-
]
209-
},
210120
{
211121
"description": "invalid anchors",
212122
"schema": {

tests/draft-next/id.json

-83
Original file line numberDiff line numberDiff line change
@@ -207,88 +207,5 @@
207207
"valid": true
208208
}
209209
]
210-
},
211-
{
212-
"description": "$id inside an enum is not a real identifier",
213-
"comment": "the implementation must not be confused by an $id buried in the enum",
214-
"schema": {
215-
"$schema": "https://json-schema.org/draft/next/schema",
216-
"$defs": {
217-
"id_in_enum": {
218-
"enum": [
219-
{
220-
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
221-
"type": "null"
222-
}
223-
]
224-
},
225-
"real_id_in_schema": {
226-
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
227-
"type": "string"
228-
},
229-
"zzz_id_in_const": {
230-
"const": {
231-
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
232-
"type": "null"
233-
}
234-
}
235-
},
236-
"anyOf": [
237-
{ "$ref": "#/$defs/id_in_enum" },
238-
{ "$ref": "https://localhost:1234/draft-next/id/my_identifier.json" }
239-
]
240-
},
241-
"tests": [
242-
{
243-
"description": "exact match to enum, and type matches",
244-
"data": {
245-
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
246-
"type": "null"
247-
},
248-
"valid": true
249-
},
250-
{
251-
"description": "match $ref to $id",
252-
"data": "a string to match #/$defs/id_in_enum",
253-
"valid": true
254-
},
255-
{
256-
"description": "no match on enum or $ref to $id",
257-
"data": 1,
258-
"valid": false
259-
}
260-
]
261-
},
262-
{
263-
"description": "non-schema object containing an $id property",
264-
"schema": {
265-
"$schema": "https://json-schema.org/draft/next/schema",
266-
"$defs": {
267-
"const_not_id": {
268-
"const": {
269-
"$id": "not_a_real_id"
270-
}
271-
}
272-
},
273-
"if": {
274-
"const": "skip not_a_real_id"
275-
},
276-
"then": true,
277-
"else" : {
278-
"$ref": "#/$defs/const_not_id"
279-
}
280-
},
281-
"tests": [
282-
{
283-
"description": "skip traversing definition for a valid result",
284-
"data": "skip not_a_real_id",
285-
"valid": true
286-
},
287-
{
288-
"description": "const at const_not_id does not match",
289-
"data": 1,
290-
"valid": false
291-
}
292-
]
293210
}
294211
]

tests/draft-next/optional/anchor.json

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
[
2+
{
3+
"description": "$anchor inside an enum is not a real identifier",
4+
"comment": "the implementation must not be confused by an $anchor buried in the enum",
5+
"schema": {
6+
"$schema": "https://json-schema.org/draft/next/schema",
7+
"$defs": {
8+
"anchor_in_enum": {
9+
"enum": [
10+
{
11+
"$anchor": "my_anchor",
12+
"type": "null"
13+
}
14+
]
15+
},
16+
"real_identifier_in_schema": {
17+
"$anchor": "my_anchor",
18+
"type": "string"
19+
},
20+
"zzz_anchor_in_const": {
21+
"const": {
22+
"$anchor": "my_anchor",
23+
"type": "null"
24+
}
25+
}
26+
},
27+
"anyOf": [
28+
{ "$ref": "#/$defs/anchor_in_enum" },
29+
{ "$ref": "#my_anchor" }
30+
]
31+
},
32+
"tests": [
33+
{
34+
"description": "exact match to enum, and type matches",
35+
"data": {
36+
"$anchor": "my_anchor",
37+
"type": "null"
38+
},
39+
"valid": true
40+
},
41+
{
42+
"description": "in implementations that strip $anchor, this may match either $def",
43+
"data": {
44+
"type": "null"
45+
},
46+
"valid": false
47+
},
48+
{
49+
"description": "match $ref to $anchor",
50+
"data": "a string to match #/$defs/anchor_in_enum",
51+
"valid": true
52+
},
53+
{
54+
"description": "no match on enum or $ref to $anchor",
55+
"data": 1,
56+
"valid": false
57+
}
58+
]
59+
},
60+
{
61+
"description": "non-schema object containing an $anchor property",
62+
"schema": {
63+
"$schema": "https://json-schema.org/draft/next/schema",
64+
"$defs": {
65+
"const_not_anchor": {
66+
"const": {
67+
"$anchor": "not_a_real_anchor"
68+
}
69+
}
70+
},
71+
"if": {
72+
"const": "skip not_a_real_anchor"
73+
},
74+
"then": true,
75+
"else" : {
76+
"$ref": "#/$defs/const_not_anchor"
77+
}
78+
},
79+
"tests": [
80+
{
81+
"description": "skip traversing definition for a valid result",
82+
"data": "skip not_a_real_anchor",
83+
"valid": true
84+
},
85+
{
86+
"description": "const at const_not_anchor does not match",
87+
"data": 1,
88+
"valid": false
89+
}
90+
]
91+
}
92+
]

tests/draft-next/optional/id.json

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
[
2+
{
3+
"description": "$id inside an enum is not a real identifier",
4+
"comment": "the implementation must not be confused by an $id buried in the enum",
5+
"schema": {
6+
"$schema": "https://json-schema.org/draft/next/schema",
7+
"$defs": {
8+
"id_in_enum": {
9+
"enum": [
10+
{
11+
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
12+
"type": "null"
13+
}
14+
]
15+
},
16+
"real_id_in_schema": {
17+
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
18+
"type": "string"
19+
},
20+
"zzz_id_in_const": {
21+
"const": {
22+
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
23+
"type": "null"
24+
}
25+
}
26+
},
27+
"anyOf": [
28+
{ "$ref": "#/$defs/id_in_enum" },
29+
{ "$ref": "https://localhost:1234/draft-next/id/my_identifier.json" }
30+
]
31+
},
32+
"tests": [
33+
{
34+
"description": "exact match to enum, and type matches",
35+
"data": {
36+
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
37+
"type": "null"
38+
},
39+
"valid": true
40+
},
41+
{
42+
"description": "match $ref to $id",
43+
"data": "a string to match #/$defs/id_in_enum",
44+
"valid": true
45+
},
46+
{
47+
"description": "no match on enum or $ref to $id",
48+
"data": 1,
49+
"valid": false
50+
}
51+
]
52+
},
53+
{
54+
"description": "non-schema object containing an $id property",
55+
"schema": {
56+
"$schema": "https://json-schema.org/draft/next/schema",
57+
"$defs": {
58+
"const_not_id": {
59+
"const": {
60+
"$id": "not_a_real_id"
61+
}
62+
}
63+
},
64+
"if": {
65+
"const": "skip not_a_real_id"
66+
},
67+
"then": true,
68+
"else" : {
69+
"$ref": "#/$defs/const_not_id"
70+
}
71+
},
72+
"tests": [
73+
{
74+
"description": "skip traversing definition for a valid result",
75+
"data": "skip not_a_real_id",
76+
"valid": true
77+
},
78+
{
79+
"description": "const at const_not_id does not match",
80+
"data": 1,
81+
"valid": false
82+
}
83+
]
84+
}
85+
]

0 commit comments

Comments
 (0)