[BUG] [Flytekit] Mismatching Type while serializing Union Types in _make_dataclass_serializable
#5910
Open
2 tasks done
_make_dataclass_serializable
#5910
Describe the bug
Mentioned in the discussion under flyteorg/flytekit#2823. When handling Union types in
_make_dataset_serializable
, we intend to select the first argument inget_args(python_type)
becauseOptional
is equivalent toUnion[ExpectedType, None]
. However, this approach may fail if the type order differs, for example, inUnion[None, ExpectedType]
.An error reproduction example:
Expected behavior
This code snippet should work, meaning that the underlying Union types in dataclasses should be serialized correctly.
Additional context to reproduce
No response
Screenshots
No response
Are you sure this issue hasn't been raised already?
Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: