Skip to content

Commit 6f6f81a

Browse files
committed
Properly handle (ignore) boolean-schema'd items in older drafts.
1 parent 93e5985 commit 6f6f81a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

referencing/jsonschema.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from __future__ import annotations
66

7-
from collections.abc import Set
7+
from collections.abc import Sequence, Set
88
from typing import Any, Iterable, Union
99

1010
from referencing import Anchor, Registry, Resource, Specification
@@ -174,10 +174,10 @@ def subresources_of(contents: Schema) -> Iterable[ObjectSchema]:
174174

175175
items = contents.get("items")
176176
if items is not None:
177-
if isinstance(items, Mapping):
178-
yield items
179-
else:
177+
if isinstance(items, Sequence):
180178
yield from items
179+
else:
180+
yield items
181181

182182
return subresources_of
183183

@@ -206,10 +206,10 @@ def subresources_of(contents: Schema) -> Iterable[ObjectSchema]:
206206

207207
items = contents.get("items")
208208
if items is not None:
209-
if isinstance(items, Mapping):
210-
yield items
211-
else:
209+
if isinstance(items, Sequence):
212210
yield from items
211+
else:
212+
yield items
213213
dependencies = contents.get("dependencies")
214214
if dependencies is not None:
215215
values = iter(dependencies.values())
@@ -257,11 +257,11 @@ def subresources_of(contents: Schema) -> Iterable[ObjectSchema]:
257257
"additionalProperties",
258258
"contains",
259259
"contentSchema",
260-
"if",
261-
"then",
262260
"else",
261+
"if",
263262
"not",
264263
"propertyNames",
264+
"then",
265265
"unevaluatedItems",
266266
"unevaluatedProperties",
267267
},

0 commit comments

Comments
 (0)