litestar-org / polyfactory

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

Refactor: get pydantic v1 model fields using `FieldMeta.from_type` #435

Closed guacs closed 8 months ago

guacs commented 10 months ago

Currently, the parsing of pydantic v1 models to get the list of FieldMeta is based on its own custom logic and does not use the FieldMeta.from_type as done in the other factories (including pydantic v2). Ideally, this should be changed so that it also uses FieldMeta.from_type which will unify the way the FieldMeta list is parsed from all the different model types.

Hopefully, this will fix #430 and unblock #412.


[!NOTE]
While we are open for sponsoring on GitHub Sponsors and OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.

Check out all issues funded or available for funding on our Polar.sh Litestar dashboard

  • If you would like to see an issue prioritized, make a pledge towards it!
  • We receive the pledge once the issue is completed & verified
  • This, along with engagement in the community, helps us know which features are a priority to our users.

Fund with Polar

guacs commented 8 months ago

Closing that as there's no easy way to do this due to the way the pydantic v1 API. Also, it's not really worth the effort to do this now since we will be dropping support for pydantic v1 in the next major release after pydantic also drops support for it.