Hello, moving from V1 to V2, this output gets created by bump-pydantic.
# TODO[pydantic]: We couldn't refactor the `validator`, please replace it by `field_validator` manually.
# Check https://docs.pydantic.dev/dev-v2/migration/#changes-to-validators for more information.
@validator("decay_time")
def decay_time_gt_rise_time(cls, v, values):
if v <= values["rise_time"]:
raise ValueError("decay_time must be greater than rise_time")
return v
When this occurs, the values need to become values.data then all works fine. Maybe this refactoring can be added to the tool.
Before (V1)
@validator("decay_time")
def decay_time_gt_rise_time(cls, v, values):
if v <= values["rise_time"]:
raise ValueError("decay_time must be greater than rise_time")
return v
After (V2)
@field_validator("decay_time")
@classmethod
def decay_time_gt_rise_time(cls, v, values):
if v <= values.data["rise_time"]:
raise ValueError("decay_time must be greater than rise_time")
return v
Hello, moving from V1 to V2, this output gets created by
bump-pydantic
.When this occurs, the
values
need to becomevalues.data
then all works fine. Maybe this refactoring can be added to the tool.Before (V1)
After (V2)