Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Bug: ignore_extra=False and allow_population_by_alias=True do not work together #257
from pydantic import BaseModel, Schema from typing import Optional class Model(BaseModel): last_updated_by: Optional[str] = Schema(None, alias="lastUpdatedBy") class Config: ignore_extra = False allow_population_by_alias = True m1 = Model(lastUpdatedBy="dmitry") # ok m2 = Model(last_updated_by="dmitry") # fails # > """ ValidationError: 1 validation error last_updated_by extra fields not permitted (type=value_error.extra) """
Additional info: read docs, including the warning, but it does not seem like this is an expected behavior.