Skip to content

Commit 0b051c9

Browse files
committed
Bring dynamic reference tests up to date with spec changes
- A dynamic reference can no longer reference anything other than a dynamic anchor - The initial resolution step was removed
1 parent 9e19974 commit 0b051c9

File tree

1 file changed

+9
-114
lines changed

1 file changed

+9
-114
lines changed

tests/v1/dynamicRef.json

Lines changed: 9 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,6 @@
2626
}
2727
]
2828
},
29-
{
30-
"description": "A $ref to a $dynamicAnchor in the same schema resource behaves like a normal $ref to an $anchor",
31-
"schema": {
32-
"$schema": "https://json-schema.org/v1",
33-
"$id": "https://test.json-schema.org/ref-dynamicAnchor-same-schema/root",
34-
"type": "array",
35-
"items": { "$ref": "#items" },
36-
"$defs": {
37-
"foo": {
38-
"$dynamicAnchor": "items",
39-
"type": "string"
40-
}
41-
}
42-
},
43-
"tests": [
44-
{
45-
"description": "An array of strings is valid",
46-
"data": ["foo", "bar"],
47-
"valid": true
48-
},
49-
{
50-
"description": "An array containing non-strings is invalid",
51-
"data": ["foo", 42],
52-
"valid": false
53-
}
54-
]
55-
},
5629
{
5730
"description": "A $dynamicRef resolves to the first $dynamicAnchor still in scope that is encountered when the schema is evaluated",
5831
"schema": {
@@ -150,58 +123,6 @@
150123
}
151124
]
152125
},
153-
{
154-
"description": "A $dynamicRef that initially resolves to a schema with a matching $dynamicAnchor resolves to the first $dynamicAnchor in the dynamic scope",
155-
"schema": {
156-
"$schema": "https://json-schema.org/v1",
157-
"$id": "https://test.json-schema.org/relative-dynamic-reference/root",
158-
"$dynamicAnchor": "meta",
159-
"type": "object",
160-
"properties": {
161-
"foo": { "const": "pass" }
162-
},
163-
"$ref": "extended",
164-
"$defs": {
165-
"extended": {
166-
"$id": "extended",
167-
"$dynamicAnchor": "meta",
168-
"type": "object",
169-
"properties": {
170-
"bar": { "$ref": "bar" }
171-
}
172-
},
173-
"bar": {
174-
"$id": "bar",
175-
"type": "object",
176-
"properties": {
177-
"baz": { "$dynamicRef": "extended#meta" }
178-
}
179-
}
180-
}
181-
},
182-
"tests": [
183-
{
184-
"description": "The recursive part is valid against the root",
185-
"data": {
186-
"foo": "pass",
187-
"bar": {
188-
"baz": { "foo": "pass" }
189-
}
190-
},
191-
"valid": true
192-
},
193-
{
194-
"description": "The recursive part is not valid against the root",
195-
"data": {
196-
"foo": "pass",
197-
"bar": {
198-
"baz": { "foo": "fail" }
199-
}
200-
},
201-
"valid": false
202-
}
203-
]
204-
},
205126
{
206127
"description": "multiple dynamic paths to the $dynamicRef keyword",
207128
"schema": {
@@ -282,7 +203,6 @@
282203
{
283204
"description": "after leaving a dynamic scope, it is not used by a $dynamicRef",
284205
"schema": {
285-
"$schema": "https://json-schema.org/v1",
286206
"$id": "https://test.json-schema.org/dynamic-ref-leaving-dynamic-scope/main",
287207
"if": {
288208
"$id": "first_scope",
@@ -309,13 +229,18 @@
309229
"start": {
310230
"$comment": "this is the landing spot from $ref",
311231
"$id": "start",
312-
"$dynamicRef": "inner_scope#thingy"
232+
"$ref": "inner_scope"
313233
},
314234
"thingy": {
315-
"$comment": "this is the first stop for the $dynamicRef",
316235
"$id": "inner_scope",
317-
"$dynamicAnchor": "thingy",
318-
"type": "string"
236+
"$dynamicRef": "#thingy",
237+
"$defs": {
238+
"": {
239+
"$comment": "this is the first stop for the $dynamicRef",
240+
"$dynamicAnchor": "thingy",
241+
"type": "string"
242+
}
243+
}
319244
}
320245
}
321246
},
@@ -613,36 +538,6 @@
613538
}
614539
]
615540
},
616-
{
617-
"description": "$dynamicRef points to a boolean schema",
618-
"schema": {
619-
"$schema": "https://json-schema.org/v1",
620-
"$defs": {
621-
"true": true,
622-
"false": false
623-
},
624-
"properties": {
625-
"true": {
626-
"$dynamicRef": "#/$defs/true"
627-
},
628-
"false": {
629-
"$dynamicRef": "#/$defs/false"
630-
}
631-
}
632-
},
633-
"tests": [
634-
{
635-
"description": "follow $dynamicRef to a true schema",
636-
"data": { "true": 1 },
637-
"valid": true
638-
},
639-
{
640-
"description": "follow $dynamicRef to a false schema",
641-
"data": { "false": 1 },
642-
"valid": false
643-
}
644-
]
645-
},
646541
{
647542
"description": "$dynamicRef skips over intermediate resources - direct reference",
648543
"schema": {

0 commit comments

Comments
 (0)