litestar-org / polyfactory

Simple and powerful factories for mock data generation
https://polyfactory.litestar.dev/
MIT License
1k stars 78 forks source link

feat: support Pydantic v1 and v2 simultaneously #492

Closed guacs closed 7 months ago

guacs commented 7 months ago

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 commented 7 months ago

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.

sonarcloud[bot] commented 7 months ago

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
86.4% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

github-actions[bot] commented 7 months ago

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