Skip to content

Commit 082b975

Browse files
1 parent 9129282 commit 082b975

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

t/additional-tests/recursiveRef.json

+51
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,56 @@
130130
"valid": true
131131
}
132132
]
133+
},
134+
{
135+
"description": "$recursiveRef with $recursiveAnchor: false works like $ref",
136+
"schema": {
137+
"$id": "http://localhost:4242/recursiveRef4/schema.json",
138+
"$recursiveAnchor": false,
139+
"$defs": {
140+
"myobject": {
141+
"$id": "myobject.json",
142+
"$recursiveAnchor": false,
143+
"anyOf": [
144+
{ "type": "string" },
145+
{
146+
"type": "object",
147+
"additionalProperties": { "$recursiveRef": "#" }
148+
}
149+
]
150+
}
151+
},
152+
"anyOf": [
153+
{ "type": "integer" },
154+
{ "$ref": "#/$defs/myobject" }
155+
]
156+
},
157+
"tests": [
158+
{
159+
"description": "integer matches at the outer level",
160+
"data": 1,
161+
"valid": true
162+
},
163+
{
164+
"description": "single level match",
165+
"data": { "foo": "hi" },
166+
"valid": true
167+
},
168+
{
169+
"description": "integer does not match as a property value",
170+
"data": { "foo": 1 },
171+
"valid": false
172+
},
173+
{
174+
"description": "two levels, properties match with inner definition",
175+
"data": { "foo": { "bar": "hi" } },
176+
"valid": true
177+
},
178+
{
179+
"description": "two levels, integer does not match as a property value",
180+
"data": { "foo": { "bar": 1 } },
181+
"valid": false
182+
}
183+
]
133184
}
134185
]

0 commit comments

Comments
 (0)