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
{{ message }}
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.
I have some fields in my dataclasses that are large unions, so I've tried setting single-value literals on them to help the decoder discriminate between them, but it looks like while literals are supported, the values aren't validated during decoding.
For example, if you have two dataclasses:
@dataclass
class Foo(JsonSchemaMixin):
common_field: int
name: Literal['Foo'] = 'Foo'
@dataclass
class Bar(JsonSchemaMixin):
common_field: int
name: Literal['Bar'] = 'Bar'
other_field: Optional[int] = None
and a dataclass that uses them as a union type,
@dataclass
class Baz(JsonSchemaMixin):
my_foo_bar: Union[Bar, Foo]
I have some fields in my dataclasses that are large unions, so I've tried setting single-value literals on them to help the decoder discriminate between them, but it looks like while literals are supported, the values aren't validated during decoding.
For example, if you have two dataclasses:
and a dataclass that uses them as a union type,
Then
will result in
even though the literals should help disciminate.
The text was updated successfully, but these errors were encountered: