I have the pydantic model that have color property
from pydantic import BaseModel
from pydantic.color import Color
class MyModel(BaseModel):
color: Color
And I define FastAPI router that returns MyModel
@router.get("/", response_model=MyModel)
async def get_my_model() -> MyModel:
item = await DbItem.get()
return MyModel(**item.dict())
In this setup pydantic converts colors to named colors (e.g. black).
My frontend don't recognize named colors.
How can I point pydantic to return hex colors?