@@ -65,6 +65,7 @@ def __init__(
65
65
self .resolver_handlers = resolver_handlers
66
66
67
67
self .operation_ids_registry : Optional [List [str ]] = None
68
+ self .schema_ids_registry : Optional [List [int ]] = None
68
69
self .resolver = None
69
70
70
71
def validate (
@@ -82,6 +83,7 @@ def iter_errors(
82
83
self , instance : Mapping [Hashable , Any ], spec_url : str = ""
83
84
) -> Iterator [ValidationError ]:
84
85
self .operation_ids_registry = []
86
+ self .schema_ids_registry = []
85
87
self .resolver = self ._get_resolver (spec_url , instance )
86
88
87
89
yield from self .schema_validator .iter_errors (instance )
@@ -248,7 +250,12 @@ def _iter_schema_errors(
248
250
if not hasattr (schema .content (), "__getitem__" ):
249
251
return
250
252
251
- schema_type = schema .getkey ("type" )
253
+ assert self .schema_ids_registry is not None
254
+ schema_id = id (schema .content ())
255
+ if schema_id in self .schema_ids_registry :
256
+ return
257
+ self .schema_ids_registry .append (schema_id )
258
+
252
259
nested_properties = []
253
260
if "allOf" in schema :
254
261
all_of = schema / "allOf"
@@ -294,7 +301,7 @@ def _iter_schema_errors(
294
301
)
295
302
296
303
if "properties" in schema :
297
- props = schema / "properties"
304
+ props = schema / "properties"
298
305
for _ , prop_schema in props .items ():
299
306
yield from self ._iter_schema_errors (
300
307
prop_schema ,
0 commit comments