Open ff137 opened 1 year ago
I ran bump-pydantic on one of our projects, and it has auto-converted the following, from:
@root_validator(pre=True) @classmethod
to:
@model_validator(mode="before") @classmethod @classmethod
This PR amends this behavior to only add the classmethod decorator if it doesn't already exist.
To test, I ran pip install /path/to/my/fork, and ran bump-pydantic . again. Now the extra decorator won't be added unnecessarily
pip install /path/to/my/fork
bump-pydantic .
Edit: Also added some tests to validate behavior
I ran bump-pydantic on one of our projects, and it has auto-converted the following, from:
to:
This PR amends this behavior to only add the classmethod decorator if it doesn't already exist.
To test, I ran
pip install /path/to/my/fork
, and ranbump-pydantic .
again. Now the extra decorator won't be added unnecessarilyEdit: Also added some tests to validate behavior