-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Use __all__ to exclude fields from all elements of a list/tuple of submodels. Raise more informative TypeError when passing bad exclude kwargs. #1286
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1286 +/- ##
=======================================
Coverage 99.89% 99.89%
=======================================
Files 21 21
Lines 3713 3725 +12
Branches 731 736 +5
=======================================
+ Hits 3709 3721 +12
Misses 2 2
Partials 2 2
Continue to review full report at Codecov.
|
|
Thanks for reviewing! Addressed all but the last question in the last commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, I've just realised we should talk about and test fo dictionaries as well as sub-models
|
Done. Should I rebase on upstream master to resolve conflicts, or do you want to handle that yourself? |
…list/tuple of child submodels
56be89a to
4d45663
Compare
|
I've made a few tiny tweaks to avoid wasting your time with another review. Will merge once tests pass. |
Change Summary
pydantic.utils.ValueItemswhenvalueis a list or tuple and the provided exclusion dict is not keyed by index.excludein the following example.'__all__'keyword to exclude fields from all elements of a sequence of submodels or dicts.Related issue number
This PR addresses a couple of my comments in #1283 -- adding a more detailed TypeError and a sentence pointing out the subtle example of correct usage. Some logic has been added to enable usage of
'__all__'in theexcludekwarg of model export methods.Checklist
changes/<pull request or issue id>-<github username>.mdfile added describing change(see changes/README.md for details)