-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Closed
Labels
Description
Hello! I have schema/view like this:
@router.get(
"/my-route/",
response_model=OutSchema,
response_model_by_alias=False,
)
async def test_route(name: str):
return await MyModel.query.where(
and_(
MyModel.name == name,
)
).gino.first_or_404()
class OutSchema(BaseModel):
id: int
type: str
object_id: str = Field(..., alias='name')
class Config:
orm_mode = TrueDescription
When i accessing route above i receive response like {'id': 123, 'type': 'smth', 'object_id': 'some_name'} which is correct
but when i open swagger i see in example response
{
"id": 0,
"type": "string",
"name": "string" # it should be object_id here instead of name
}It look like fastapi issue because of response_model_by_alias usage
Environment
- OS: Linux
- FastAPI Version: 0.55.1
- Python version: 3.7
jceresini, farhaanshaikh19, hyzyla, Pycz, darren-hardy-uplight and 6 more