Harun Yasar
Harun Yasar
As far as I know, aliased field names are used for model inputs. In order to use aliased fields in dictionary representation of a model you could call `dict(by_alias=True)`. There...
I guess you set it up wrong. I simply recommend you to go through `pydantic` `BaseModel` config [documentation](https://pydantic-docs.helpmanual.io/usage/model_config/). ```python from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import...
In fact, I would briefly suggest you define fields in the opposite direction. There are two different discussions on the subject [here](https://github.com/tiangolo/fastapi/issues/1810) and [here](https://github.com/tiangolo/fastapi/issues/771).
@vishalwy I got your case. Have you checked the discussions that I have mentioned above? It seems to be `response_model_by_alias` is discouraged.
You could use Pydantic's dataclass extension. It doesn't just give you the same data validation features but also fix your issue. ```python from __future__ import annotations from typing import List,...
Same here.