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
I'm trying to have a dataclass field take on either a StrEnum or an int. Using from_dict() works when StrEnum is used, but unioned with int throws a parse error.
What I Did
In the examples below, Example works but Example2 throws a parse error:
> raise ParseError(
TypeError('Object was not in any of Union types'),
o, [p.base_type for p in self.parsers],
tag_key=self.tag_key
)
E dataclass_wizard.errors.ParseError: Failure parsing field `test` in class `Example2`. Expected a type [<enum 'Value'>, <class 'int'>], got str.
E value: 'default'
E error: Object was not in any of Union types
E tag_key: '__tag__'
E json_object: '{"test": "default"}'
The text was updated successfully, but these errors were encountered:
Description
I'm trying to have a dataclass field take on either a
StrEnum
or anint
. Usingfrom_dict()
works when StrEnum is used, but unioned with int throws a parse error.What I Did
In the examples below,
Example
works butExample2
throws a parse error:Here's the error output:
The text was updated successfully, but these errors were encountered: