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

validator functions not recognized as classmethods for dataclasses #466

Closed
igorbga opened this issue Apr 7, 2022 · 1 comment · Fixed by #609
Closed

validator functions not recognized as classmethods for dataclasses #466

igorbga opened this issue Apr 7, 2022 · 1 comment · Fixed by #609

Comments

@igorbga
Copy link

igorbga commented Apr 7, 2022

Describe the bug
If I use a @validator decorator in a Pydantic regular model Pycharm does not complain about first parameter being called "cls", but if instead I use a Pydantic dataclass it complains

To Reproduce

from pydantic.dataclasses import dataclass

@dataclass(frozen=True)
class MyValueObject:
    value: str

    @validator('value')
    def _value_validator(cls, value):
        return value

Expected behavior
I would expect it not to complain about "cls" as it already does for BaseModels

Environments (please complete the following information):

  • IDE: PyCharm Community 2021.3.3
  • OS: Ubuntu 18.03
  • Pydantic Version 1.9.0
  • Plugin version 0.3.12
@koxudaxi
Copy link
Owner

@igorbga
I'm sorry for my too-late reply.
The fixed version has been released.
Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants