I updated the pydantic version and code is breaking with the error
Field 'allowed_type' defined on a base class
was overridden by a non-annotated attribute. All field
definitions, including overrides, require a type
annotation.
class AllowedType(str, Enum):
YES = "YES"
NO = "NO"
class APIResponse(BaseModel):
allowed_type: AllowedType
def to_json(self):
return json.dumps(
{
"allowed_type": self.allowed_type,
}
)
None of the solutions mentioned here work for me : /2.6/errors/usage_errors/#model-field-overridden