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
No key validation for typed __pydantic_extra__
#9400
Labels
Comments
RLKRo
added
bug V2
Bug related to Pydantic V2
pending
Awaiting a response / confirmation
labels
May 6, 2024
sydney-runkle
added
feature request
and removed
bug V2
Bug related to Pydantic V2
pending
Awaiting a response / confirmation
labels
May 14, 2024
Marking this as a feature request, because I believe we could add Thanks for the FR. PRs welcome! |
Would also be great to be able to annotate
instead of calling MyValidator inside |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Initial Checks
Description
Adding type annotation for
__pydantic_extra__
only validates values of the extra fields.I expected that annotating
__pydantic_extra__
with something likeDict[constr(pattern="..."), str]
would lead to validation of extra field names.In the example below
__pydantic_extra__
is annotated asDict[constr(pattern="extra"), str]
which I expected to lead to validation errors for any extra field names that do not contain "extra".If this behavior is intended, documentation
should mention that field names are not validated.
Example Code
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: