I have an Enum:
class DataType(Enum):
TIMESTAMP = MyClass("ts")
DATETIME = MyClass("dt")
DATE = MyClass("date")
and a Pydantic Model with a field of the type of that Enum:
class Aggregation(BaseModel):
field_data_type: DataType
Is there a convenient way to tell Pydantic to validate the Model field against the names of the enum rather than the values?
i.e to be able to build this Model:
agg = Aggregation(field_data_type="TIMESTAMP")