Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of module pydantic.v1 Since update to Pydantic V2 #90

Open
Merinorus opened this issue Feb 26, 2024 · 2 comments
Open

Support of module pydantic.v1 Since update to Pydantic V2 #90

Merinorus opened this issue Feb 26, 2024 · 2 comments

Comments

@Merinorus
Copy link
Contributor

Merinorus commented Feb 26, 2024

Hello,

Since the V2 update, Pydantic V2 still includes the V1 models to make the migration easier : https://docs.pydantic.dev/latest/migration/#continue-using-pydantic-v1-features

Example :

 from pydantic.v1 import BaseModel

Unfortunately, it seems flask-pydantic dropped the V1 support when it started to support Pydantic V2 (from version 0.12.0).
So, if we have to upgrade, we cannot use the pydantic.v1 legacy models with Flask-Pydantic and we have to migrate the whole project's models to Pydantic V2 models directly. Right?

@yctomwang
Copy link
Collaborator

Hi there @Merinorus , yes we have dropped support for pydantic v1, however you can still use the old version on pypi which supports the V1...

@Merinorus
Copy link
Contributor Author

Merinorus commented Jun 14, 2024

Hi @yctomwang,
So, developers must migrate the whole project in one step whereas they could have the ability to use progressively V2 base models. This is unfortunate because it makes migration much harder from Pydantic V1 to Pydantic V2 in a Flask project.

I opened a PR for this. I could make it work with a Flask project with Pydantic 2.7 and V1 base models. No performance impact should be noticed.

@yctomwang yctomwang reopened this Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants