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

"extra" config not respected for TypedDicts in functions #3161

Closed
3 tasks done
mayanksharma3 opened this issue Sep 2, 2021 · 0 comments · Fixed by #3177
Closed
3 tasks done

"extra" config not respected for TypedDicts in functions #3161

mayanksharma3 opened this issue Sep 2, 2021 · 0 comments · Fixed by #3177
Labels
bug V1 Bug related to Pydantic V1.X

Comments

@mayanksharma3
Copy link

mayanksharma3 commented Sep 2, 2021

Checks

  • I added a descriptive title to this issue
  • I have searched (google, github) for similar issues and couldn't find anything
  • I have read and followed the docs and still think this is a bug

Bug

Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":

             pydantic version: 1.8.2
            pydantic compiled: False
                 install path: /home/msharma216/.local/lib/python3.8/site-packages/pydantic
               python version: 3.8.0 (default, Feb 25 2021, 22:10:10)  [GCC 8.4.0]
                     platform: Linux-4.4.0-19041-Microsoft-x86_64-with-glibc2.27
     optional deps. installed: ['typing-extensions']

When trying to use the validate_arguments decorator, I face the issue of getting validation errors for an extra attribute for a TypedDict as below:

from typing_extensions import TypedDict

from pydantic import validate_arguments, Extra


class TypedTest(TypedDict):
    y: str


@validate_arguments(config={'extra': Extra.allow})
def test(other: TypedTest):
    pass


test(other={'y': 'b', 'z': 'a'})

Output:

pydantic.error_wrappers.ValidationError: 1 validation error for Test
other -> z
  extra fields not permitted (type=value_error.extra)

Expected: No errors

Anything I have missed that would let this validation pass for extra attributes in the TypedDict?

Thanks very much!

@mayanksharma3 mayanksharma3 added the bug V1 Bug related to Pydantic V1.X label Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V1 Bug related to Pydantic V1.X
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant