Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated migration.md to add description of how to push down Field constraints to generics #7751

Merged
merged 1 commit into from Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/migration.md
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