Use pydantic models #837
Replies: 1 comment 2 replies
-
I don't really remember why we didn't use Pydantic way back when. I think we started with only Having a version of the templates which uses Pydantic for models instead of I could see a world where you can independently select the model style ( |
Beta Was this translation helpful? Give feedback.
-
Hi,
i'm using the that project for quite some time to generate openapi clients and frankly, it is by far the most usable library in that area!
However, i was wondering why pydantic is not used for models/dtos as well? Maybe there has been a discussion on this topic that i have missed, but since pydantic is anyway used internally (e.g. for parsing the openapi spec) why not just use it for DTOs as well? Especially now with pydantic v2, advantages like better support for type-hints, performance, convenience are numerous. Even more, there are projects like datamodel-code-generator around that might become handy in that regard as well..?
Is there any reason why to favor attrs over pydantic or was pydantic back then just not sufficiently mature enough? Pydantic was only at 1.4, back when the first release of that project was published to pypi..
Having a modern openapi client gen is i guess curcial for any ecosystem and this project is imho - to point it out once again - by far the best there is out there, when it comes to type-hints, generated code, support for pyproject.toml, http-client, asyncio etc....
Since the pydantic/fastapi "stack" got lots of attention recently, i was wondering whether this project could potentially go into similar directions in the future - and of course i'd be happy to contribute myself to such endeavors..
cheers
Beta Was this translation helpful? Give feedback.
All reactions