File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 1+ v4.18.2
2+ =======
3+
4+ * Fix an additional regression with the deprecated ``jsonschema.RefResolver `` and pointer resolution.
5+
16v4.18.1
27=======
38
Original file line number Diff line number Diff line change @@ -2394,6 +2394,25 @@ def handle(uri):
23942394 (False , True ),
23952395 )
23962396
2397+ def test_refresolver_with_pointer_in_schema_with_no_id (self ):
2398+ """
2399+ See https://github.com/python-jsonschema/jsonschema/issues/1124#issuecomment-1632574249.
2400+ """ # noqa: E501
2401+
2402+ schema = {
2403+ "properties" : {"x" : {"$ref" : "#/definitions/x" }},
2404+ "definitions" : {"x" : {"type" : "integer" }},
2405+ }
2406+
2407+ validator = validators .Draft202012Validator (
2408+ schema ,
2409+ resolver = validators ._RefResolver ("" , schema ),
2410+ )
2411+ self .assertEqual (
2412+ (validator .is_valid ({"x" : "y" }), validator .is_valid ({"x" : 37 })),
2413+ (False , True ),
2414+ )
2415+
23972416
23982417
23992418def sorted_errors (errors ):
Original file line number Diff line number Diff line change @@ -278,7 +278,9 @@ def __attrs_post_init__(self):
278278 # REMOVEME: Legacy ref resolution state management.
279279 push_scope = getattr (self ._ref_resolver , "push_scope" , None )
280280 if push_scope is not None :
281- push_scope (id_of (self .schema ))
281+ id = id_of (self .schema )
282+ if id is not None :
283+ push_scope (id )
282284
283285 @classmethod
284286 def check_schema (cls , schema , format_checker = _UNSET ):
You can’t perform that action at this time.
0 commit comments