File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -89,12 +89,20 @@ class _RutPydanticAnnotation:
8989 JavaScript (ECMA 262), which does not support Python’s named groups.
9090 """
9191
92+ VALIDATE_RUT_DV : ClassVar [bool ] = False
93+ """
94+ Whether to validate the RUT's "digito verificador".
95+ """
96+
9297 @classmethod
9398 def __get_pydantic_core_schema__ (
9499 cls , source_type : Any , handler : pydantic .GetCoreSchemaHandler
95100 ) -> pydantic_core .core_schema .CoreSchema :
101+ foo_schema = pydantic_core .core_schema .any_schema ()
102+ print ('foo_schema' , foo_schema )
103+
96104 def validate_from_str (value : str ) -> cl_sii .rut .Rut :
97- return cl_sii .rut .Rut (value , validate_dv = False )
105+ return cl_sii .rut .Rut (value , validate_dv = cls . VALIDATE_RUT_DV )
98106
99107 from_str_schema = pydantic_core .core_schema .chain_schema (
100108 [
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ def setUpClass(cls) -> None:
2727
2828 cls .ThirdPartyType = Rut
2929 cls .PydanticThirdPartyType = PydanticRut
30- cls .pydantic_type_adapter = pydantic .TypeAdapter (cls .PydanticThirdPartyType )
30+ cls .pydantic_type_adapter = pydantic .TypeAdapter (cls .PydanticThirdPartyType , config = pydantic . ConfigDict ( json_schema_extra = { 'hello' : 'world' }) )
3131
3232 cls .valid_instance_1 = cls .ThirdPartyType ('78773510-K' )
3333 assert isinstance (cls .valid_instance_1 , cls .ThirdPartyType )
You can’t perform that action at this time.
0 commit comments