Files
pydantic/docs/examples/config.py
T
Samuel Colvin 6923e5e677 models allowing immutability (#44)
* working on models allowing immutability, ref #38

* up complexity

* use noqa c901

* fixing fields with new processor

* allow_mutation config and tests

* uprev, history and docs

* fix typos
2017-06-13 09:52:47 +01:00

17 lines
820 B
Python

from pydantic import BaseModel
class UserModel(BaseModel):
id: int = ...
class Config:
min_anystr_length = 0 # min length for str & byte types
max_anystr_length = 2 ** 16 # max length for str & byte types
min_number_size = -2 ** 64 # min size for numbers
max_number_size = 2 ** 64 # max size for numbers
validate_all = False # whether or not to validate field defaults
ignore_extra = True # whether to ignore any extra values in input data
allow_extra = False # whether or not too allow (and include on the model) any extra values in input data
allow_mutation = True # whether or not models are faux-immutable, eg. setattr fails on model fields
fields = None # extra information on each field, currently just "alias is allowed"