summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2021-08-18 09:04:39 +0100
committerJulian Berman <Julian@GrayVines.com>2021-08-18 09:05:32 +0100
commit7f677965d26846e20e2e417f6201bb7e2cde554e (patch)
tree697622fc17f45cdb2ec1f203eb8dc67543090089
parente78a62dc83106ef1dc8e173ba43896af6631d7c2 (diff)
downloadjsonschema-7f677965d26846e20e2e417f6201bb7e2cde554e.tar.gz
Remove the $defs validator.
This isn't correct, $defs doesn't have behavior (it isn't an assertion). The reason these tests fail is because the dynamicRef implementation isn't fully correct (will need some restructuring).
-rw-r--r--jsonschema/tests/test_jsonschema_test_suite.py30
-rw-r--r--jsonschema/validators.py2
2 files changed, 3 insertions, 29 deletions
diff --git a/jsonschema/tests/test_jsonschema_test_suite.py b/jsonschema/tests/test_jsonschema_test_suite.py
index 1d8a804..c0ddddd 100644
--- a/jsonschema/tests/test_jsonschema_test_suite.py
+++ b/jsonschema/tests/test_jsonschema_test_suite.py
@@ -413,36 +413,12 @@ TestDraft202012 = DRAFT202012.to_unittest_testcase(
skip=lambda test: (
narrow_unicode_build(test)
or skip(
- message="Issue: Resolving of dynamicRef based on dynamic scope",
+ message="dynamicRef support isn't working yet.",
subject="dynamicRef",
- case_description="A $dynamicRef that initially resolves to a "
- "schema with a matching $dynamicAnchor should "
- "resolve to the first $dynamicAnchor in the "
- "dynamic scope",
- description='The recursive part is not valid against the root',
)(test)
or skip(
- message="Issue: Resolving of dynamicRef based on dynamic scope",
- subject="dynamicRef",
- case_description="multiple dynamic paths to the $dynamicRef "
- "keyword",
- description="recurse to integerNode - floats are not allowed",
- )(test)
- or skip(
- message="Issue: Resolving of dynamicRef based on dynamic scope",
- subject="dynamicRef",
- case_description="after leaving a dynamic scope, it should not be "
- "used by a $dynamicRef",
- description="/then/$defs/thingy is the final stop for the "
- "$dynamicRef",
- )(test)
- or skip(
- message="Issue: Resolving of dynamicRef based on dynamic scope",
- subject="dynamicRef",
- case_description="after leaving a dynamic scope, it should not be "
- 'used by a $dynamicRef',
- description="string matches /$defs/thingy, but the $dynamicRef "
- "does not stop here",
+ message="These tests depends on dynamicRef working.",
+ subject="defs",
)(test)
),
)
diff --git a/jsonschema/validators.py b/jsonschema/validators.py
index a6c20eb..3c28b8d 100644
--- a/jsonschema/validators.py
+++ b/jsonschema/validators.py
@@ -456,7 +456,6 @@ Draft202012Validator = create(
vocabulary_schemas=_utils.load_vocabulary("draft2020-12"),
validators={
"$ref": _validators.ref,
- "$defs": _validators.defs,
"$dynamicRef": _validators.dynamicRef,
"additionalItems": _validators.additionalItems,
"additionalProperties": _validators.additionalProperties,
@@ -744,7 +743,6 @@ class RefResolver(object):
fragment = fragment.lstrip("/")
- # Resolve fragment via $anchor or $dynamicAnchor
if fragment:
for keyword in ["$anchor", "$dynamicAnchor"]:
for subschema in self._finditem(document, keyword):