summaryrefslogtreecommitdiff
path: root/jsonschema/_validators.py
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2021-08-18 09:23:00 +0100
committerJulian Berman <Julian@GrayVines.com>2021-08-18 09:23:00 +0100
commitd104bdbe2ce3f283e4e2bbf2a5fe7f6f7d6f7280 (patch)
tree9275f20a02d7c91f2a8cb509af90040fa2a624b9 /jsonschema/_validators.py
parent7f677965d26846e20e2e417f6201bb7e2cde554e (diff)
downloadjsonschema-d104bdbe2ce3f283e4e2bbf2a5fe7f6f7d6f7280.tar.gz
May as well add support for Draft 2019 as well.
recursiveRef is broken in the same way dynamicRef is.
Diffstat (limited to 'jsonschema/_validators.py')
-rw-r--r--jsonschema/_validators.py25
1 files changed, 4 insertions, 21 deletions
diff --git a/jsonschema/_validators.py b/jsonschema/_validators.py
index 77063fa..d2f699f 100644
--- a/jsonschema/_validators.py
+++ b/jsonschema/_validators.py
@@ -342,35 +342,18 @@ def dynamicRef(validator, dynamicRef, instance, schema):
for url in scope_stack:
lookup_url = urljoin(url, dynamicRef)
- with validator.resolver.resolving(lookup_url) as lookup_schema:
- if ("$dynamicAnchor" in lookup_schema
- and fragment == lookup_schema["$dynamicAnchor"]):
- subschema = lookup_schema
+ with validator.resolver.resolving(lookup_url) as subschema:
+ if ("$dynamicAnchor" in subschema
+ and fragment == subschema["$dynamicAnchor"]):
for error in validator.descend(instance, subschema):
yield error
break
else:
- with validator.resolver.resolving(dynamicRef) as lookup_schema:
- subschema = lookup_schema
+ with validator.resolver.resolving(dynamicRef) as subschema:
for error in validator.descend(instance, subschema):
yield error
-def defs(validator, defs, instance, schema):
- if not validator.is_type(instance, "object"):
- return
-
- if '$defs' in instance:
- for definition, subschema in instance['$defs'].items():
- for error in validator.descend(
- subschema,
- schema,
- path=definition,
- schema_path=definition,
- ):
- yield error
-
-
def type(validator, types, instance, schema):
types = ensure_list(types)