mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 14:50:19 +00:00
ce67660d2f
* add support for class kwargs config * reformat tests * add changes file and docs * fix linting in 'inherit_config' * tweak docs Co-authored-by: Samuel Colvin <s@muelcolvin.com>
12 lines
192 B
Python
12 lines
192 B
Python
from pydantic import BaseModel, ValidationError, Extra
|
|
|
|
|
|
class Model(BaseModel, extra=Extra.forbid):
|
|
a: str
|
|
|
|
|
|
try:
|
|
Model(a='spam', b='oh no')
|
|
except ValidationError as e:
|
|
print(e)
|