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

fix: handle unions properly #491

Merged
merged 13 commits into from
Jan 20, 2024
Merged

fix: handle unions properly #491

merged 13 commits into from
Jan 20, 2024

Conversation

guacs
Copy link
Member

@guacs guacs commented Jan 20, 2024

Description

This is a rewrite of #412, but it fixes the issues that was there with pydantic v1.

Quoting from the above mentioned PR:

This PR fixes the handling of unions. The use of unwrap_args would result in the incorrect creation of children for the field meta. It would just return a random instance of the union and it fails completely in the case of unions of collection types like list[int] | list[str] where unwrap_args might return (int,) for type_args when in fact we want (list[int], list[str]).

Close Issue(s)

@guacs guacs requested review from a team as code owners January 20, 2024 05:07
pyproject.toml Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Jan 20, 2024

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

1 New issue
0 Security Hotspots
78.3% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

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

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.

Bug: Pydantic fields with constraints and multiple type hints cause ParameterException
2 participants