Skip to content

Commit 637f0ac

Browse files
authored
Merge pull request #542 from jdesrosiers/dyanmicref-no-bookending
Update dynamicRef tests for bookenending removal
2 parents 87944e5 + 89f59ca commit 637f0ac

File tree

1 file changed

+2
-145
lines changed

1 file changed

+2
-145
lines changed

tests/draft-next/dynamicRef.json

Lines changed: 2 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,6 @@
2525
}
2626
]
2727
},
28-
{
29-
"description": "A $dynamicRef to an $anchor in the same schema resource should behave like a normal $ref to an $anchor",
30-
"schema": {
31-
"$id": "https://test.json-schema.org/dynamicRef-anchor-same-schema/root",
32-
"type": "array",
33-
"items": { "$dynamicRef": "#items" },
34-
"$defs": {
35-
"foo": {
36-
"$anchor": "items",
37-
"type": "string"
38-
}
39-
}
40-
},
41-
"tests": [
42-
{
43-
"description": "An array of strings is valid",
44-
"data": ["foo", "bar"],
45-
"valid": true
46-
},
47-
{
48-
"description": "An array containing non-strings is invalid",
49-
"data": ["foo", 42],
50-
"valid": false
51-
}
52-
]
53-
},
5428
{
5529
"description": "A $ref to a $dynamicAnchor in the same schema resource should behave like a normal $ref to an $anchor",
5630
"schema": {
@@ -90,13 +64,7 @@
9064
"list": {
9165
"$id": "list",
9266
"type": "array",
93-
"items": { "$dynamicRef": "#items" },
94-
"$defs": {
95-
"items": {
96-
"$comment": "This is only needed to satisfy the bookending requirement",
97-
"$dynamicAnchor": "items"
98-
}
99-
}
67+
"items": { "$dynamicRef": "#items" }
10068
}
10169
}
10270
},
@@ -130,13 +98,7 @@
13098
"list": {
13199
"$id": "list",
132100
"type": "array",
133-
"items": { "$dynamicRef": "#items" },
134-
"$defs": {
135-
"items": {
136-
"$comment": "This is only needed to satisfy the bookending requirement",
137-
"$dynamicAnchor": "items"
138-
}
139-
}
101+
"items": { "$dynamicRef": "#items" }
140102
}
141103
}
142104
},
@@ -169,7 +131,6 @@
169131
"items": { "$dynamicRef": "#items" },
170132
"$defs": {
171133
"items": {
172-
"$comment": "This is only needed to satisfy the bookending requirement",
173134
"$dynamicAnchor": "items"
174135
}
175136
}
@@ -184,69 +145,6 @@
184145
}
185146
]
186147
},
187-
{
188-
"description": "A $dynamicRef without a matching $dynamicAnchor in the same schema resource should behave like a normal $ref to $anchor",
189-
"schema": {
190-
"$id": "https://test.json-schema.org/dynamic-resolution-without-bookend/root",
191-
"$ref": "list",
192-
"$defs": {
193-
"foo": {
194-
"$dynamicAnchor": "items",
195-
"type": "string"
196-
},
197-
"list": {
198-
"$id": "list",
199-
"type": "array",
200-
"items": { "$dynamicRef": "#items" },
201-
"$defs": {
202-
"items": {
203-
"$comment": "This is only needed to give the reference somewhere to resolve to when it behaves like $ref",
204-
"$anchor": "items"
205-
}
206-
}
207-
}
208-
}
209-
},
210-
"tests": [
211-
{
212-
"description": "Any array is valid",
213-
"data": ["foo", 42],
214-
"valid": true
215-
}
216-
]
217-
},
218-
{
219-
"description": "A $dynamicRef with a non-matching $dynamicAnchor in the same schema resource should behave like a normal $ref to $anchor",
220-
"schema": {
221-
"$id": "https://test.json-schema.org/unmatched-dynamic-anchor/root",
222-
"$ref": "list",
223-
"$defs": {
224-
"foo": {
225-
"$dynamicAnchor": "items",
226-
"type": "string"
227-
},
228-
"list": {
229-
"$id": "list",
230-
"type": "array",
231-
"items": { "$dynamicRef": "#items" },
232-
"$defs": {
233-
"items": {
234-
"$comment": "This is only needed to give the reference somewhere to resolve to when it behaves like $ref",
235-
"$anchor": "items",
236-
"$dynamicAnchor": "foo"
237-
}
238-
}
239-
}
240-
}
241-
},
242-
"tests": [
243-
{
244-
"description": "Any array is valid",
245-
"data": ["foo", 42],
246-
"valid": true
247-
}
248-
]
249-
},
250148
{
251149
"description": "A $dynamicRef that initially resolves to a schema with a matching $dynamicAnchor should resolve to the first $dynamicAnchor in the dynamic scope",
252150
"schema": {
@@ -298,47 +196,6 @@
298196
}
299197
]
300198
},
301-
{
302-
"description": "A $dynamicRef that initially resolves to a schema without a matching $dynamicAnchor should behave like a normal $ref to $anchor",
303-
"schema": {
304-
"$id": "https://test.json-schema.org/relative-dynamic-reference-without-bookend/root",
305-
"$dynamicAnchor": "meta",
306-
"type": "object",
307-
"properties": {
308-
"foo": { "const": "pass" }
309-
},
310-
"$ref": "extended",
311-
"$defs": {
312-
"extended": {
313-
"$id": "extended",
314-
"$anchor": "meta",
315-
"type": "object",
316-
"properties": {
317-
"bar": { "$ref": "bar" }
318-
}
319-
},
320-
"bar": {
321-
"$id": "bar",
322-
"type": "object",
323-
"properties": {
324-
"baz": { "$dynamicRef": "extended#meta" }
325-
}
326-
}
327-
}
328-
},
329-
"tests": [
330-
{
331-
"description": "The recursive part doesn't need to validate against the root",
332-
"data": {
333-
"foo": "pass",
334-
"bar": {
335-
"baz": { "foo": "fail" }
336-
}
337-
},
338-
"valid": true
339-
}
340-
]
341-
},
342199
{
343200
"description": "multiple dynamic paths to the $dynamicRef keyword",
344201
"schema": {

0 commit comments

Comments
 (0)