Skip to content

Commit

Permalink
Add coerce_numbers_to_str option in StringSchema (#1262)
Browse files Browse the repository at this point in the history
  • Loading branch information
NeevCohen committed Apr 4, 2024
1 parent 683c5a3 commit 4b82169
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/pydantic_core/core_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ class StringSchema(TypedDict, total=False):
to_upper: bool
regex_engine: Literal['rust-regex', 'python-re'] # default: 'rust-regex'
strict: bool
coerce_numbers_to_str: bool
ref: str
metadata: Any
serialization: SerSchema
Expand Down
1 change: 1 addition & 0 deletions src/validators/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ impl StrConstrainedValidator {
|| self.strip_whitespace
|| self.to_lower
|| self.to_upper
|| self.coerce_numbers_to_str
}
}

Expand Down

0 comments on commit 4b82169

Please sign in to comment.