<#3391 Added support for Enum types in Pydantic mo...
# flyte-github
a
#3391 Added support for Enum types in Pydantic models Pull request opened by AdilFayyaz ## Tracking issue Duplicated from: flyteorg/flyte-sdk/pull/622 ## Why are the changes needed? Ensure flytekit versions alongside flytesdk ## What changes were proposed in this pull request? In
generate_attribute_list_from_dataclass_json_mixin()
, when a $ref resolves to an enum definition (has enum key, no properties), map the field to str instead of trying to construct a dataclass from it. Previously this crashed with KeyError: 'properties' because the code assumed every $ref pointed to a model. ## How was this patch tested? Test (test_enum_in_pydantic.py): Defines a Job(BaseModel) with a Status(str, Enum) field, roundtrips it through to_literal_type -> to_literal -> to_python_value -> guess_python_type, and verifies the guessed dataclass accepts enum values as strings. ### Setup process ### Screenshots ## Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. ## Related PRs ## Docs link flyteorg/flytekit