How to use Union without type conversion?
import pydantic
from typings import Union
class Foo(pydantic.BaseModel):
foo: Union[int, float]
assert isinstance(Foo(foo=1.1), float), "will throw an error"
I know that I can flip Union[float, int], but now all foo will always be floats.
There's no way currently, you need to wait until #619 or the change I just suggested on #1423.