Skip to content

Commit

Permalink
docs(usage): update migration docs
Browse files Browse the repository at this point in the history
  • Loading branch information
benbenbang committed Jul 30, 2023
1 parent 053538c commit b26dc20
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/migration.md
Expand Up @@ -238,6 +238,10 @@ See [Model Config](usage/model_config.md) for more details.
for the annotated type will _also_ be applied even to defaults, not just the custom validators. For
example, despite the fact that the validator below will never error, the following code raises a `ValidationError`:

!!! note
To avoid this, you can use the `validate_default` argument in the `Field` function. When set to `True`, it mimics the behavior of `always=True` in pydantic v1. However, the new way of using `validate_default` is encouraged as it provides more flexibility and control.


```python test="skip"
from pydantic import BaseModel, validator

Expand Down

0 comments on commit b26dc20

Please sign in to comment.