diff options
author | Julian Berman <Julian@GrayVines.com> | 2022-05-05 16:54:57 -0400 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2022-05-05 16:55:32 -0400 |
commit | fb85c6620ff26823362ebd27b8577995c0841028 (patch) | |
tree | e6c6ed824a02cf725079f22965610da57bdfeacd /jsonschema/_validators.py | |
parent | 3b2f0f36c73b61fd72a87ab468e46b24119ae9e0 (diff) | |
download | jsonschema-fb85c6620ff26823362ebd27b8577995c0841028.tar.gz |
Revert "Extend dynamicRef keyword"v4.5.1
It needs performance optimization. See python-jsonschema/jsonschema#941.
This reverts commit 12c791ee81baf27e54d18baf95b975bd48387dc6.
Diffstat (limited to 'jsonschema/_validators.py')
-rw-r--r-- | jsonschema/_validators.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/jsonschema/_validators.py b/jsonschema/_validators.py index 8caaa7e..9a07f5e 100644 --- a/jsonschema/_validators.py +++ b/jsonschema/_validators.py @@ -3,7 +3,6 @@ from urllib.parse import urldefrag, urljoin import re from jsonschema._utils import ( - dynamic_anchor_extender, ensure_list, equal, extras_msg, @@ -303,21 +302,14 @@ def ref(validator, ref, instance, schema): def dynamicRef(validator, dynamicRef, instance, schema): _, fragment = urldefrag(dynamicRef) + for url in validator.resolver._scopes_stack: lookup_url = urljoin(url, dynamicRef) with validator.resolver.resolving(lookup_url) as subschema: if ("$dynamicAnchor" in subschema and fragment == subschema["$dynamicAnchor"]): - scope_stack = list(validator.resolver._scopes_stack) - scope_stack.reverse() - extended_schema = dynamic_anchor_extender( - validator, scope_stack, fragment, schema, subschema, - ) - if extended_schema: - yield from validator.descend(instance, extended_schema) - break - yield from validator.descend(instance, subschema) + break else: with validator.resolver.resolving(dynamicRef) as subschema: yield from validator.descend(instance, subschema) |