fix: Add support for Pydantic v2.12#1471
Conversation
vdusek
left a comment
There was a problem hiding this comment.
I'm not sure about this workaround - shouldn't we wait for a fix on the Pydantic side instead?
I'm not sure that Pydantic will fix this. Since the default value was factually ignored before 2.12, we set it for the type checker. An example of a discussion in the Pydantic repository - pydantic/pydantic#6713 (comment) |
vdusek
left a comment
There was a problem hiding this comment.
Thanks for the explanation. The best solution would be if the Pydantic Mypy plugin were able to handle this issue (default_factory vs. standard default field values) - https://docs.pydantic.dev/2.12/integrations/mypy/#enabling-the-plugin. But since it's not the case, this is probably the 2nd best solution, so LGTM.
Description
Annotated[..., Field(default_factory=...)]and with type hints.Issues