koxudaxi / fastapi-code-generator

This code generator creates FastAPI app from an openapi file.
MIT License
1.08k stars 109 forks source link

Support for pydantic2 #378

Closed bohndthi closed 5 months ago

bohndthi commented 1 year ago

Since Pydantic V2 has been finally released (https://docs.pydantic.dev/2.0/blog/pydantic-v2-final/) it would be great to add support for it.

n0nvme commented 1 year ago

fastapi-code-generator uses datamodel-code-generator to generate pydantic models. New version of datamodel-codegen already have support for pydantic v2, so I guess #379 should fix the issue.

serjflint commented 1 year ago

@n0nvme you are right, but this package uses the fixed version of datamodel

datamodel-code-generator =  {extras = ["http"], version = "0.16.1"}
serjflint commented 1 year ago

V2 was introduced in v0.21.0

coolofficials commented 9 months ago

Any plans for this..?

shippo-beth commented 9 months ago

I cannot use fastapi 0.103.0 with latest pydantic-settings from extras with your project because of this limitation.

fastapi (0.103.0) depends on pydantic-settings (>=2.0.0), fastapi (0.103.0) requires pydantic (>=2.0b3).
And because fastapi-code-generator (0.4.4) depends on pydantic (>=1.5.1,<2.0.0)

Are there any plans to prioritize this soon?