Start here
The safe first move
Replace Extra.forbid (and Extra.allow, Extra.ignore) with the string literal 'forbid', 'allow', or 'ignore' in model_config.
Stop before automation when: Dynamic extra config based on runtime logic. Files with other unsupported Config keys.
Target shape
from pydantic import BaseModel, ConfigDict
class Strict(BaseModel):
model_config = ConfigDict(extra="forbid")