We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 97d6af8 commit 8ff159aCopy full SHA for 8ff159a
pydantic_xml/model.py
@@ -429,7 +429,12 @@ def __init_subclass__(
429
430
cls.__xml_field_serializers__ = {}
431
cls.__xml_field_validators__ = {}
432
- for attr_name in dir(cls):
+
433
+ # find custom validators/serializers in all defined attributes
434
+ # though we want to skip any Base(Xml)Model attributes, as these can never be field
435
+ # serializers/validators, and getting certain pydantic fields, like __pydantic_post_init__
436
+ # may cause recursion errors for recursive / self-referential models
437
+ for attr_name in set(dir(cls)) - set(dir(BaseXmlModel)):
438
if func := getattr(cls, attr_name, None):
439
if fields := getattr(func, '__xml_field_serializer__', None):
440
for field in fields:
0 commit comments