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

feat: support Pydantic v1 and v2 simultaneously #492

Merged
merged 5 commits into from
Jan 21, 2024
Merged

feat: support Pydantic v1 and v2 simultaneously #492

merged 5 commits into from
Jan 21, 2024

Conversation

guacs
Copy link
Member

@guacs guacs commented Jan 21, 2024

Description

Pydantic v2 allows for using both v2 and v1 models at the same time. This PR changes the logic in the ModelFactory to allow for that.

Close Issue(s)

@guacs guacs requested review from a team as code owners January 21, 2024 07:01
@guacs
Copy link
Member Author

guacs commented Jan 21, 2024

A lot of the test files saw changes due to the change in the section order of ruff's import sorting. The only relevant tests for this PR are in test_pydantic_v1_v2.py.

Copy link

sonarcloud bot commented Jan 21, 2024

polyfactory/factories/pydantic_factory.py Dismissed Show dismissed Hide dismissed
Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/polyfactory-docs-preview/492

Copy link
Member

@provinzkraut provinzkraut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @guacs!

@guacs guacs merged commit 46ecdc6 into main Jan 21, 2024
23 checks passed
@guacs guacs deleted the pydantic-v1-v2 branch January 21, 2024 12:29
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

Successfully merging this pull request may close these issues.

Enhancement: support Pydantic v1 and v2 at the same time
2 participants