#6572 [BUG] Using Enum in Pydantic model throws error when using Flyte
Issue created by
HansBambel
### Flyte & Flytekit version
flytekit 1.16.1
union 0.1.190
### Describe the bug
When using an enum as a field in a pydantic model I receive the following error when I run the code with Flyte:
"add_flyte_validators_for_type..validator() takes 1 positional argument but 2 were given"
When I run it without Flyte I do not receive an error.
### Expected behavior
To not throw an error and validate using the enums possible values.
An ugly workaround could be:
class DataSequenceConfig(BaseModel):
feature: Literal[*[val for val in FeatureType]]
But my IDE is complaining and Flyte also has a warning when running.
### Additional context to reproduce
This code works fine by its own:
class FeatureType(StrEnum):
"""Enum for feature types."""
OUTCOME = "outcome"
SCORE = "score"
class DataSequenceConfig(BaseModel):
feature: FeatureType
my_config = DataSequenceConfig(feature="outcome") # or FeatureType.OUTCOME
But when using it when flyte is used it results in the error
add_flyte_validators_for_type.<locals>.validator() takes 1 positional argument but 2 were given
### Screenshots
No response
### Are you sure this issue hasn't been raised already?
• Yes
### Have you read the Code of Conduct?
• Yes
flyteorg/flyte