Find serialize_as_any usage affected by the Pydantic 2.12 unification
ProprietaryPydantic 2.12 unified the serialize_as_any flag with the SerializeAsAny annotation, which can change serialization output versus 2.11. This recipe flags serialize_as_any= on model_dump / model_dump_json (and TypeAdapter.dump_python / dump_json) for review, since there is no safe mechanical rewrite. Only fires where the receiver's type resolves to pydantic.BaseModel, pydantic.TypeAdapter or a subclass.
org. openrewrite. python. migrate. pydantic. FindSerializeAsAnyUsagemod run . --recipe= org. openrewrite. python. migrate. pydantic. FindSerializeAsAnyUsageInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.