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

@root_validator will not updated to model_validator #134

Open
saber-solooki opened this issue Oct 19, 2023 · 1 comment
Open

@root_validator will not updated to model_validator #134

saber-solooki opened this issue Oct 19, 2023 · 1 comment
Labels
good first issue Good for newcomers

Comments

@saber-solooki
Copy link

saber-solooki commented Oct 19, 2023

Description

I have a @root_validator without having any parameter in my project like this:

from pydantic import BaseModel, root_validator

class Model(BaseModel):
    name: str

    @root_validator
    def validate_root(cls, values):
        return values

In this way, bump-pydantic can't detect it and will not update it to a new version and without any TODO or anything.
Also, if I define my root_validator like @root_validator(), it will be detected and converted to @model_validator() without defining mode parameter.
The only successful convert will happen if I have @root_validator(pre=True). I've not checked other scenarios.

If it is an accepted bug, I will be happy to work on it and make a PR

My Environment

Python 3.11.4
bump-pydantic==0.7.0

@Kludex
Copy link
Member

Kludex commented Dec 27, 2023

Hi @saber-solooki , do you still want to work on this? I'll be happy to review a PR. :)

@Kludex Kludex added the good first issue Good for newcomers label Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants