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
importreimporttypingfrompydanticimportBaseModelclassModel(BaseModel):
typing_pattern: typing.Pattern# this is supportedre_pattern: re.Pattern# RuntimeError: no validator found for <class 're.Pattern'>, see `arbitrary_types_allowed` in Config
fromtypingimportTypefrompydanticimportBaseModelclassModel(BaseModel):
cls: Type# treated as Type[Any]cls: type# RuntimeError: no validator found for <class 'type'>, see `arbitrary_types_allowed` in Config
It's pretty easy to fix, but my hands are full now. Would appreciate somebody picking this up.
Would require adding or self.type_ is re.Pattern here:
Initial Checks
Description
Ref: #4334 (comment)
It's pretty easy to fix, but my hands are full now. Would appreciate somebody picking this up.
Would require adding
or self.type_ is re.Pattern
here:pydantic/pydantic/fields.py
Line 599 in 11d8589
adding
or type_ is re.Pattern
here:pydantic/pydantic/validators.py
Line 687 in 11d8589
and replacing part after
or
withfield_type is type_ and (type_ is Pattern or type_ is re.Pattern)
pydantic/pydantic/schema.py
Line 805 in 11d8589
As for bare
type
, you'd need to addif type_ is type: return True
before this line:pydantic/pydantic/typing.py
Line 572 in 11d8589
Affected Components
.dict()
and.json()
construct()
, pickling, private attributes, ORM modeThe text was updated successfully, but these errors were encountered: