mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
Be more specific about the meaning of Config.extra (#1203)
* Be more specific about the meaning of Config.extra When reading through the docs as a beginner, it was not clear to me what the difference between `'allow'` and `'ignore'` was. I fixed this by adding a short description of each of the options from what I can tell from reading the source code. Is there a better way to format this? Maybe as a list? (ps, thanks for the cool library) * tiny further clarification * sorry... Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
This commit is contained in:
@@ -19,7 +19,9 @@ Options:
|
||||
|
||||
**`extra`**
|
||||
: whether to ignore, allow, or forbid extra attributes during model initialization. Accepts the string values of
|
||||
`'ignore'`, `'allow'`, or `'forbid'`, or values of the `Extra` enum (default: `Extra.ignore`)
|
||||
`'ignore'`, `'allow'`, or `'forbid'`, or values of the `Extra` enum (default: `Extra.ignore`).
|
||||
`'forbid'` will cause validation to fail if extra attributes are included, `'ignore'` will silently ignore any extra attributes,
|
||||
and `'allow'` will assign the attributes to the model.
|
||||
|
||||
**`allow_mutation`**
|
||||
: whether or not models are faux-immutable, i.e. whether `__setattr__` is allowed (default: `True`)
|
||||
|
||||
Reference in New Issue
Block a user