fastapi-code-generator icon indicating copy to clipboard operation
fastapi-code-generator copied to clipboard

Support for pydantic2

Open bohndthi opened this issue 2 years ago • 5 comments

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.

bohndthi avatar Aug 17 '23 11:08 bohndthi

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.

n0nvme avatar Aug 20 '23 14:08 n0nvme

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

datamodel-code-generator =  {extras = ["http"], version = "0.16.1"}

serjflint avatar Aug 30 '23 10:08 serjflint

V2 was introduced in v0.21.0

serjflint avatar Aug 30 '23 10:08 serjflint

Any plans for this..?

coolofficials avatar Feb 20 '24 06:02 coolofficials

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?

shippo-beth avatar Feb 21 '24 17:02 shippo-beth