Skip to content

dataclasses.InitVar not supported #592

@pfrederiks

Description

@pfrederiks

Bug

When a dataclass contains an InitVar field, pydantic will try to validate it and does not pass the InitVar to post_init.

Using InitVar will raise the following error:

RuntimeError: no validator found for <class 'dataclasses.InitVar'>

And when arbitrary_types_allowed is set the following exception is raised:

TypeError: _pydantic_post_init() takes 1 positional argument but 2 were given

I have a pull request.

For bugs/questions:

  • OS: any
  • Python version: 3.7
  • Pydantic version : 0.28

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions