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
msgspec is wonderful, but only supports Unions that have None as the second type.
An example of the problem is:
import msgspec as ms
from typing import Union
class Example(ms.Struct):
field1: Union[float, int, None] = 1.0
if __name__ == "__main__":
temp = Example()
encoded = ms.json.encode(temp)
decoded = ms.convert(encoded, type=Example)
which will raise the error
TypeError: Type unions containing a custom type may not contain any additional types other than `None` - type `typing.Union[float, int, NoneType]` is not supported
The text was updated successfully, but these errors were encountered:
Description
msgspec is wonderful, but only supports Unions that have
None
as the second type.An example of the problem is:
which will raise the error
The text was updated successfully, but these errors were encountered: