Open pfrantz opened 10 months ago
In Pydantic 2.x, the regex attribute for specifying regular expressions in the Field class has been removed, and you should use the pattern attribute instead. Here's how you can update your code:
from pydantic import BaseModel, Field, constr
class MyModel(BaseModel):
email: constr(regex=RE_EMAIL_PATTERN)
Bug
if you define a field like
The program when run gives the following exception:-
Current Behavior
just define a Field that has a regex defined
Expected behavior
it would be good to align with Pydantic and support the patten keyword argument
Environment
Additional context
Add any other context about the problem here.