You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see the argument for changing it, but it's a very annoying breaking change to understand, so my instinct is we don't change this, even in a major update.
As for the reason - my guess is that the best explanation is "because that's how it was first done" and there hasn't been a strong (enough) argument to change it.
see below, lowercase/uppercase is set to true and strip whitespaces is set to true. Interestingly, we see the second part of email is always lowercase. This is very strange behavior. Though, I can exclude strip_whitespace as EmailStr takes care of striping whitespaces.
I'm bit confused when to use and not to use strip_whitespace. Should we use strip_whitespace with others params?
frompydanticimportBaseModel, EmailStr, StringConstraintsfromtypingimportAnnotatedEStr=Annotated[EmailStr, StringConstraints(to_lower=True, strip_whitespace=True)]
classFoo(BaseModel):
bar: EStrFoo(bar="uSeR@ExAmPlE.com")
>>>Foo(bar='uSeR@example.com')
It's StringConstraints issue after EmailStr validation it has to apply lower/upper case as required but strip_whitespace doesn't make any other parameters work in StringContraints.
see below, lowercase/uppercase is set to true and strip whitespaces is set to true. Interestingly, we see the second part of email is always lowercase. This is very strange behavior. Though, I can exclude strip_whitespace as EmailStr takes care of striping whitespaces.
I'm bit confused when to use and not to use
strip_whitespace
. Should we usestrip_whitespace
with others params?Originally posted by @SDAravind in #8577 (comment)
The text was updated successfully, but these errors were encountered: