mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
Docs: Add validators to dynamic model (#1963)
* Add dynamic validators to doc * Update models_dynamic_validators.py * Update models_dynamic_validators.py * Adding example (success and error) * Update models_dynamic_validators.py
This commit is contained in:
@@ -370,6 +370,12 @@ extending a base model with extra fields.
|
||||
{!.tmp_examples/models_dynamic_inheritance.py!}
|
||||
```
|
||||
|
||||
You can also add validators by passing a dict to the `__validators__` argument.
|
||||
|
||||
```py
|
||||
{!.tmp_examples/models_dynamic_validators.py!}
|
||||
```
|
||||
|
||||
## Custom Root Types
|
||||
|
||||
Pydantic models can be defined with a custom root type by declaring the `__root__` field.
|
||||
|
||||
Reference in New Issue
Block a user