Skip to content

Commit

Permalink
Replace pre=True with mode="before"
Browse files Browse the repository at this point in the history
Pydantic v2 eliminated the pre=True flag on field validators and
replaced it with mode="before". Change the documentation accordingly.
  • Loading branch information
rra committed Sep 14, 2023
1 parent c039f1f commit b0f9fd8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/user-guide/pydantic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Here's an example of how to use it:
examples=[1614986130],
)
_normalize_last_used = field_validator("last_used", pre=True)(
_normalize_last_used = field_validator("last_used", mode="before")(
normalize_datetime
)
Expand Down
4 changes: 2 additions & 2 deletions src/safir/pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Info(BaseModel):
examples=[1614986130],
)
_normalize_last_used = field_validator("last_used", pre=True)(
_normalize_last_used = field_validator("last_used", mode="before")(
normalize_datetime
)
"""
Expand Down Expand Up @@ -102,7 +102,7 @@ class Info(BaseModel):
examples=["2023-01-25T15:44:34Z"],
)
_normalize_last_used = field_validator("last_used", pre=True)(
_normalize_last_used = field_validator("last_used", mode="before")(
normalize_isodatetime
)
"""
Expand Down

0 comments on commit b0f9fd8

Please sign in to comment.