← All recipes
Moderne licensed

Find serialize_as_any usage affected by the Pydantic 2.12 unification

Recipe IDorg.openrewrite.python.migrate.pydantic.FindSerializeAsAnyUsageArtifactopenrewrite-migrate-python

Pydantic 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.

Single recipepythonpydanticmigration2.12Proprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.python.migrate.pydantic.FindSerializeAsAnyUsage

If the recipe isn’t available locally, install it with:

mod config recipes pip install openrewrite-migrate-python