<#2267 [Housekeeping] [flytekit] Investigate bette...
# flytekit
c
#2267 [Housekeeping] [flytekit] Investigate better handling of incorrect dataclass/enum types Issue created by wild-endeavor ## Describe the issue Issue originally reported in https://flyte-org.slack.com/archives/C01P3B761A6/p1647360364170899 from dataclasses import dataclass from dataclasses_json import dataclass_json from enum import Enum from flytekit import task, workflow # ERROR: having these two annotations causes # TypeError: __call__() missing 1 required positional argument: 'value' @dataclass_json @dataclass class Aggregation(Enum): GROUP_1x1 = "1x1" GROUP_5x1 = "5x1" @dataclass_json @dataclass class Nested: agg: Aggregation @task def tsk(nested: Nested): if nested.agg == Aggregation.GROUP_1x1: print("1x1") elif nested.agg == Aggregation.GROUP_5x1: print("5x1") else: raise ValueError("bad aggregation value") @workflow def wf(): a = tsk(nested=Nested(agg=Aggregation.GROUP_1x1)) if name == "__main__": wf() The combination of dataclass and Enum (which shouldn't be done) causes errors that are hard to understand. Investigate whether flytekit can report this error any better. ### Are you sure this issue hasn't been raised already? • Yes ### Have you read the Code of Conduct? • Yes flyteorg/flyte