[Pydantic > 2] Replace for loop in `factory.py` model generation
Closed this issue · 1 comments
Feature Request
We use polyfactory
for model generation in Ralph testing. Unfortunately, there is -at the time of this issue- a bug in the package when generating fields like Union[T, List[T]]
. The fields are sometimes properly generated, sometimes not.
To circumvent this, we wrap the model generation in try/except
a loop until a good model is generated. This is clearly not ideal and should be removed once the polyfactory issue is fixed.
This would also allow to remove the class UnionStrListStr
, created for the same purpose.
polyfactory issue: litestar-org/polyfactory#366
polyfactory most recent PR: litestar-org/polyfactory#412
Fixed before merging following fix in polyfactory: https://github.com/litestar-org/polyfactory/releases/tag/v2.14.1