Initial Checks
Description
I was recently asked for a way to require ascii-only text, and couldn't see anything better than requiring a regex accepting the ascii charset range in StringConstraints.
I would think that an ascii_only option (name to be bikeshed) would be more user-friendly. It's potentially also possible to check for ascii-only characters a lot cheaper without using a regex.
Affected Components
Initial Checks
Description
I was recently asked for a way to require ascii-only text, and couldn't see anything better than requiring a regex accepting the ascii charset range in
StringConstraints.I would think that an
ascii_onlyoption (name to be bikeshed) would be more user-friendly. It's potentially also possible to check for ascii-only characters a lot cheaper without using a regex.Affected Components
.model_dump()and.model_dump_json()model_construct(), pickling, private attributes, ORM mode