Find @model_validator(mode='after') on a classmethod

Proprietary

Pydantic 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.FindModelValidatorAfterClassmethod
mod run . --recipe=org.openrewrite.python.migrate.pydantic.FindModelValidatorAfterClassmethod

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.