Remove ... (Ellipsis) from Field()
Recipe ID
org.openrewrite.python.migrate.pydantic.RemoveEllipsisFromFieldArtifactopenrewrite-migrate-pythonPydantic 2.10 recommends against using Ellipsis (...) with Field to mark a field as required, as it does not play well with static type checkers. Rewrite Field(...) to Field() (and Field(..., x=y) to Field(x=y)), keeping the remaining arguments. Only calls resolving to pydantic.fields.Field are rewritten.
Single recipepythonpydanticmigration2.10Proprietary
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.RemoveEllipsisFromFieldIf the recipe isn’t available locally, install it with:
mod config recipes pip install openrewrite-migrate-python