Find @model_validator(mode='after') on a classmethod
ProprietaryPydantic 2.12 deprecated @model_validator with mode='after' on a classmethod; the implicit classmethod conversion for after model validators is removed in V3. Such validators should be instance methods (self, no @classmethod). This recipe flags the decorator for review, since the rewrite is not safe to mechanize. field_validator is unaffected.
org. openrewrite. python. migrate. pydantic. FindModelValidatorAfterClassmethodmod run . --recipe= org. openrewrite. python. migrate. pydantic. FindModelValidatorAfterClassmethodInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.