@@ -65,6 +65,7 @@ def __init__(
6565 self .resolver_handlers = resolver_handlers
6666
6767 self .operation_ids_registry : Optional [List [str ]] = None
68+ self .schema_ids_registry : Optional [List [int ]] = None
6869 self .resolver = None
6970
7071 def validate (
@@ -82,6 +83,7 @@ def iter_errors(
8283 self , instance : Mapping [Hashable , Any ], spec_url : str = ""
8384 ) -> Iterator [ValidationError ]:
8485 self .operation_ids_registry = []
86+ self .schema_ids_registry = []
8587 self .resolver = self ._get_resolver (spec_url , instance )
8688
8789 yield from self .schema_validator .iter_errors (instance )
@@ -248,7 +250,12 @@ def _iter_schema_errors(
248250 if not hasattr (schema .content (), "__getitem__" ):
249251 return
250252
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+
252259 nested_properties = []
253260 if "allOf" in schema :
254261 all_of = schema / "allOf"
@@ -294,7 +301,7 @@ def _iter_schema_errors(
294301 )
295302
296303 if "properties" in schema :
297- props = schema / "properties"
304+ props = schema / "properties"
298305 for _ , prop_schema in props .items ():
299306 yield from self ._iter_schema_errors (
300307 prop_schema ,
0 commit comments