Skip to content

Commit

Permalink
Updated migration.md add Field constraint section
Browse files Browse the repository at this point in the history
  • Loading branch information
NickG123 committed Oct 5, 2023
1 parent 32ea570 commit 0b71773
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ The following properties have been removed from or changed in `Field`:
- `regex` (use `pattern` instead)
- `final` (use the `typing.Final` type hint instead)

Field constraints are no longer automatically pushed down to the parameters of generics. For example, you can no longer validate every element of a list matches a regex by providing `my_list: list[str] = Field(pattern=".*")`. Instead, use `typing.Annotated` to provide an annotation on the `str` itself: `my_list: list[Annotated[str, Field(pattern=".*")]]`

* [TODO: Need to document any other backwards-incompatible changes to `pydantic.Field`]


Expand Down

0 comments on commit 0b71773

Please sign in to comment.