← All recipes
Moderne licensed

Replace populate_by_name with validate_by_name

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

Pydantic 2.11 introduced validate_by_name as the equivalent of populate_by_name, which is pending deprecation in Pydantic V3. Rename ConfigDict(populate_by_name=...) to ConfigDict(validate_by_name=...). This is behavior-preserving (validate_by_alias defaults to True) and future-proofs the configuration.

Single recipepythonpydanticmigration2.11Proprietary

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

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

mod config recipes pip install openrewrite-migrate-python