pydantic-core
pydantic-core copied to clipboard
remove self reference from serializer
Because I just worked through this, in case it's helpful, the specific (and only, as far as I can tell) spot where a circular reference is currently working its way into the serializer is through the cls
field of the outer_schema
being passed to the SchemaSerializer
here:
https://github.com/pydantic/pydantic/blob/6ab42070483907d70e62c2b2fea37832e7c2748d/pydantic/_internal/_model_construction.py#L181-L188
Think this issue also related to this one https://github.com/pydantic/pydantic/issues/6736
"Additionally I saw that if I make that attribute private, when calling to the function attribute it sends over self as argument, when I would not expect that behaviour."