We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repro (requires Python >3.12):
from dataclasses import dataclass from serde.yaml import to_yaml @dataclass class Foo: a: int @dataclass class Bar: b: int @dataclass class ContainerUnion: data: Foo | Bar c = ContainerUnion(Foo(1)) print(to_yaml(c)) # ok type FooBar = Foo | Bar @dataclass class ContainerType: data: FooBar c = ContainerType(Foo(1)) print(to_yaml(c)) # serde.compat.SerdeError: Unsupported type: Foo
https://typing.readthedocs.io/en/latest/spec/aliases.html#type-statement
The text was updated successfully, but these errors were encountered:
Not that if you remove type (i.e. FooBar = Foo | Bar), then it works.
type
FooBar = Foo | Bar
So that's a good enough workaround for now, for me, since I don't need generics.
Sorry, something went wrong.
No branches or pull requests
Repro (requires Python >3.12):
https://typing.readthedocs.io/en/latest/spec/aliases.html#type-statement
The text was updated successfully, but these errors were encountered: