You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Repeated uses of a TypeAdapter with a model breaks when using defer_build.
Traceback (most recent call last):
File "/ptest.py", line 40, in <module>
ta.validate_python({"foo": "str"})
File "/venv/lib/python3.11/site-packages/pydantic/type_adapter.py", line 283, in validate_python
return self.validator.validate_python(__object, strict=strict, from_attributes=from_attributes, context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/pydantic/_internal/_mock_val_ser.py", line 47, in __getattr__
raise PydanticUserError(self._error_message, code=self._code)
pydantic.errors.PydanticUserError: `Foo` is not fully defined; you should define all referenced types, then call `Foo.model_rebuild()`.
For further information visit **https://errors.pydantic.dev/2.4/u/class-not-fully-defined**
zakstucke
changed the title
BaseModel with "defer_build": True breaks with TypeAdapter.
BaseModel with defer_build breaks with TypeAdapter.
Oct 3, 2023
Initial Checks
Description
Repeated uses of a
TypeAdapter
with a model breaks when usingdefer_build
.Example Code
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: