88 State ,
99)
1010from cuenca_validations .types .identities import CurpField
11+ from pydantic import ConfigDict , Field
1112
1213from ..http import Session , session as global_session
1314from .base import Creatable , Retrievable
@@ -17,44 +18,42 @@ class CurpValidation(Creatable, Retrievable):
1718 _resource : ClassVar = 'curp_validations'
1819
1920 created_at : dt .datetime
20- names : Optional [str ] = None
21- first_surname : Optional [str ] = None
22- second_surname : Optional [str ] = None
23- date_of_birth : Optional [dt .date ] = None
24- country_of_birth : Optional [Country ] = None
25- state_of_birth : Optional [State ] = None
26- gender : Optional [Gender ] = None
27- nationality : Optional [Country ] = None
28- manual_curp : Optional [CurpField ] = None
29- calculated_curp : CurpField
30- validated_curp : Optional [CurpField ] = None
31- renapo_curp_match : bool
32- renapo_full_match : bool
33-
34- class Config :
35- fields = {
36- 'names' : {'description' : 'Official name from Renapo' },
37- 'first_surname' : {'description' : 'Official surname from Renapo' },
38- 'second_surname' : {'description' : 'Official surname from Renapo' },
39- 'country_of_birth' : {'description' : 'In format ISO 3166 Alpha-2' },
40- 'state_of_birth' : {'description' : 'In format ISO 3166 Alpha-2' },
41- 'nationality' : {'description' : 'In format ISO 3166 Alpha-2' },
42- 'manual_curp' : {'description' : 'curp provided in request' },
43- 'calculated_curp' : {
44- 'description' : 'Calculated CURP based on request data'
45- },
46- 'validated_curp' : {
47- 'description' : 'CURP validated in Renapo, null if not exists'
48- },
49- 'renapo_curp_match' : {
50- 'description' : 'True if CURP exists and is valid'
51- },
52- 'renapo_full_match' : {
53- 'description' : 'True if all fields provided match the response'
54- ' from RENAPO. Accents in names are ignored'
55- },
56- }
57- schema_extra = {
21+ names : Optional [str ] = Field (None , description = 'Official name from Renapo' )
22+ first_surname : Optional [str ] = Field (
23+ None , description = 'Official surname from Renapo'
24+ )
25+ second_surname : Optional [str ] = Field (
26+ None , description = 'Official surname from Renapo'
27+ )
28+ date_of_birth : Optional [dt .date ] = Field (
29+ None , description = 'In format ISO 3166 Alpha-2'
30+ )
31+ country_of_birth : Optional [Country ] = Field (
32+ None , description = 'In format ISO 3166 Alpha-2'
33+ )
34+ state_of_birth : Optional [State ] = Field (None , description = 'State of birth' )
35+ gender : Optional [Gender ] = Field (None , description = 'Gender' )
36+ nationality : Optional [Country ] = Field (
37+ None , description = 'In format ISO 3166 Alpha-2'
38+ )
39+ manual_curp : Optional [CurpField ] = Field (
40+ None , description = 'curp provided in request'
41+ )
42+ calculated_curp : CurpField = Field (
43+ description = 'Calculated CURP based on request data'
44+ )
45+ validated_curp : Optional [CurpField ] = Field (
46+ None , description = 'CURP validated in Renapo, null if not exists'
47+ )
48+ renapo_curp_match : bool = Field (
49+ description = 'True if CURP exists and is valid'
50+ )
51+ renapo_full_match : bool = Field (
52+ description = 'True if all fields provided match the response from '
53+ 'RENAPO. Accents in names are ignored' ,
54+ )
55+ model_config = ConfigDict (
56+ json_schema_extra = {
5857 'example' : {
5958 'id' : 'CVNEUInh69SuKXXmK95sROwQ' ,
6059 'created_at' : '2019-08-24T14:15:22Z' ,
@@ -72,7 +71,8 @@ class Config:
7271 'renapo_curp_match' : True ,
7372 'renapo_full_match' : True ,
7473 }
75- }
74+ },
75+ )
7676
7777 @classmethod
7878 def create (
@@ -98,4 +98,4 @@ def create(
9898 gender = gender ,
9999 manual_curp = manual_curp ,
100100 )
101- return cls ._create (session = session , ** req .dict ())
101+ return cls ._create (session = session , ** req .model_dump ())
0 commit comments