You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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")defdecay_time_gt_rise_time(cls, v, values):
ifv<=values["rise_time"]:
raiseValueError("decay_time must be greater than rise_time")
returnv
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")defdecay_time_gt_rise_time(cls, v, values):
ifv<=values["rise_time"]:
raiseValueError("decay_time must be greater than rise_time")
returnv
After (V2)
@field_validator("decay_time")@classmethoddefdecay_time_gt_rise_time(cls, v, values):
ifv<=values.data["rise_time"]:
raiseValueError("decay_time must be greater than rise_time")
returnv
The text was updated successfully, but these errors were encountered:
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)
The text was updated successfully, but these errors were encountered: