File tree 3 files changed +27
-1
lines changed
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
+
1
6
v4.18.1
2
7
=======
3
8
Original file line number Diff line number Diff line change @@ -2394,6 +2394,25 @@ def handle(uri):
2394
2394
(False , True ),
2395
2395
)
2396
2396
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
+
2397
2416
2398
2417
2399
2418
def sorted_errors (errors ):
Original file line number Diff line number Diff line change @@ -278,7 +278,9 @@ def __attrs_post_init__(self):
278
278
# REMOVEME: Legacy ref resolution state management.
279
279
push_scope = getattr (self ._ref_resolver , "push_scope" , None )
280
280
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 )
282
284
283
285
@classmethod
284
286
def check_schema (cls , schema , format_checker = _UNSET ):
You can’t perform that action at this time.
0 commit comments