no-pydantic-validation-opt-out
Report Pydantic strict-validation opt-outs.
Why
Lax field, schema, or call settings can coerce a value even when the surrounding Pydantic model uses strict validation.
Fix
Remove explicit lax overrides to keep the enclosing validation policy. Set strict=True in the validate_call or TypeAdapter configuration, or at the adapter validation call.
Examples
from pydantic import BaseModel, Field
class RetryPolicy(BaseModel, strict=True): attempts: int = Field(strict=False)from pydantic import BaseModel
class RetryPolicy(BaseModel, strict=True): attempts: intfrom pydantic import TypeAdapter
def parse_attempt(value: str | int) -> int: return TypeAdapter(int).validate_python(value)from pydantic import TypeAdapter
def parse_attempt(value: str | int) -> int: return TypeAdapter(int).validate_python(value, strict=True)