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: respect override of optional nested model fields #420

Merged
merged 6 commits into from
Oct 22, 2023

Conversation

julioolvr
Copy link
Contributor

@julioolvr julioolvr commented Oct 20, 2023

Pull Request Checklist

  • New code has 100% test coverage
  • (If applicable) The prose documentation has been updated to reflect the changes introduced by this PR
  • (If applicable) The reference documentation has been updated to reflect the changes introduced by this PR
  • Pre-Commit Checks were ran and passed
  • Tests were ran and passed

Description

  • Fixes None being randomly assigned to optional fields whose type is another model even if attributes for that model are passed to build as a dict

Close Issue(s)


I tried to mimic the structure of other tests on the file but open to feedback. The code change makes sense to me (if there are build parameters defined for a given field, don't consider setting it to None) but there might be other code paths I'm not considering.

@julioolvr julioolvr requested review from a team as code owners October 20, 2023 19:57
Copy link
Member

@guacs guacs left a comment

Choose a reason for hiding this comment

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

Thank you!

tests/test_build.py Outdated Show resolved Hide resolved
tests/test_build.py Outdated Show resolved Hide resolved
tests/test_build.py Outdated Show resolved Hide resolved
tests/test_build.py Outdated Show resolved Hide resolved
@github-actions
Copy link

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

Copy link
Member

@guacs guacs left a comment

Choose a reason for hiding this comment

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

Thanks!

@guacs guacs merged commit 5d64bde into litestar-org:main Oct 22, 2023
20 checks passed
@guacs
Copy link
Member

guacs commented Oct 22, 2023

@all-contributors add @julioolvr for code, test

@allcontributors
Copy link
Contributor

@guacs

I've put up a pull request to add @julioolvr! 🎉

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: Can't consistently override optional fields with nested models
2 participants