Closed ccwienk closed 3 years ago
nevermind. Turns out I should have read the python-documentation more thoroughly. Using the ellipsis (...
) like so will work (only tested for dacite 1.6.0
:
@dataclasses.dataclass
class A:
seq: typing.Tuple[typing.Union[int, str], ...]
Up to
1.4.0
, it was possible to deserialise tuples w/ mixed elements. Starting from1.5.0
, this no longer works.Reproducer
--> works w/ dacite
1.4.0
. Greater versions will return:dacite.exceptions.WrongTypeError: wrong value type for field "seq" - should be "typing.Tuple[typing.Union[int, str]]" instead of value "(1, 'foo')" of type "tuple"