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
feat: pass config to NamedTuple fields #4225
feat: pass config to NamedTuple fields #4225
Conversation
please review |
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.
Thanks good catch! Passing the config to TypedDict has been added recently. We should have done it for NamedTuple at the same time
Sweet, thanks for the quick review ❤️ |
@synek Thanks for your patch 👍 |
Please update |
Thanks for the review @hramezani. Do you need any other changes, or is the PR ready? |
No, we actually waiting for @samuelcolvin for final review |
thanks so much. |
Change Summary
This PR changes the way pydantic validates
NamedTuple
fields. Currently, a new vanillaBaseModel
is created dynamically for the field, and used for validation. This PR simply passes the parent model'sConfig
to that newly created model, allowing settings likeallow_arbitrary_types
to be propagated to the attributes ofNamedTuple
fields.Related issue number
fix #4219
Checklist
changes/<pull request or issue id>-<github username>.md
file added describing change(see changes/README.md for details)