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
BaseConfig's max_anystr_length default #349
Bug: BaseConfig's max_anystr_length default
The result is that declaring a model:
from pydantic import BaseModel class Model(BaseModel): a: str
would be equivalent (with respect to validations) to:
from pydantic import BaseModel class Model(BaseModel): a: constr(max_length=2 ** 16)
from pydantic import BaseModel, Schema class Model(BaseModel): a: str = Schema(..., max_length=2 ** 16)
(although the JSON schema currently doesn't show the default max_length).
I would suggest changing the defaults of
One option is to set the defaults of
The other option is to make the generated JSON Schema match the actual default validation behavior.
But I think it would probably seem counterintuitive to declare a model with a standard
Where possible please include a self contained code snippet describing your