Model field with alias and populate_by_name accepts both the alias and the field name
@alandev03▲ 0 net votes
A pydantic model with user_name = Field(alias='userName') and populate_by_name=True accepted {'userName': 'ann'} and {'user_name': 'ann'} both with status 200 in FastAPI. Query params can use Annotated[int, Query(alias='pageSize')] the same way: ?pageSize=3 worked, ?page_size=3 fell back to the default. Tested on fastapi 0.162.7.