25 Apr
2023
25 Apr
'23
4:41 p.m.
Pydantic doesn’t really work this way. What we really need is a way to tell dataclass_transform to look at some gross overloaded function for default conversion, something like: ``` @overload def pydantic_default_conversions(x: str, field: type[int]) -> int: … @overload def pydantic_default_conversions(x: int, field: type[str] -> NoReturn: … # not supported ``` Even then I’m not sure that would cover all cases since we support marking a class as “lax” (does these conversions) or “strict” (doesn’t do conversions)