Skip to content

Commit ee1a810

Browse files
committed
Do a bit more ahead-of-time for pointer checking.
1 parent 2c74a61 commit ee1a810

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

referencing/jsonschema.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,19 +229,21 @@ def _maybe_in_subresource(
229229
in_subvalues: Set[str] = frozenset(),
230230
in_subarray: Set[str] = frozenset(),
231231
):
232+
in_child = in_subvalues | in_subarray
233+
232234
def maybe_in_subresource(
233235
segments: Sequence[int | str],
234236
resolver: _Resolver[Any],
235237
subresource: Resource[Any],
236238
) -> _Resolver[Any]:
237239
_segments = iter(segments)
238240
for segment in _segments:
239-
if segment in in_value:
240-
continue
241-
elif segment in in_subarray or segment in in_subvalues:
242-
if next(_segments, None) is not None:
243-
continue
244-
return resolver
241+
if (
242+
segment not in in_value
243+
and segment not in in_child
244+
or next(_segments, None) is None
245+
):
246+
return resolver
245247
return resolver.in_subresource(subresource)
246248

247249
return maybe_in_subresource

0 commit comments

Comments
 (0)