1
1
from uuid import UUID
2
2
3
- from pydantic import BaseModel , Field , EmailStr , ConfigDict
3
+ from pydantic import BaseModel , Field , EmailStr , ConfigDict , SecretStr
4
4
5
5
config = ConfigDict (from_attributes = True )
6
6
7
7
8
8
# TODO: add pydantic field validator for strong password
9
9
class UserSchema (BaseModel ):
10
10
model_config = config
11
- email : EmailStr = Field (title = "User’s email" , description = "User’s email" )
12
- first_name : str = Field (title = "User’s first name" , description = "User’s first name" )
13
- last_name : str = Field (title = "User’s last name" , description = "User’s last name" )
14
- password : str = Field (title = "User’s password" , description = "User’s password" )
11
+ email : EmailStr = Field (title = "User’s email" , description = "User’s email" , examples = [ "john@domain.com" ] )
12
+ first_name : str = Field (title = "User’s first name" , description = "User’s first name" , examples = [ "John" ] )
13
+ last_name : str = Field (title = "User’s last name" , description = "User’s last name" , examples = [ "Doe" ] )
14
+ password : SecretStr = Field (title = "User’s password" , description = "User’s password" , examples = [ "@SuperSecret123" ] )
15
15
16
16
17
17
class UserResponse (BaseModel ):
@@ -29,5 +29,5 @@ class TokenResponse(BaseModel):
29
29
30
30
class UserLogin (BaseModel ):
31
31
model_config = config
32
- email : EmailStr = Field (title = "User’s email" , description = "User’s email" )
33
- password : str = Field (title = "User’s password" , description = "User’s password" )
32
+ email : EmailStr = Field (title = "User’s email" , description = "User’s email" , examples = [ "john@domain.com" ] )
33
+ password : SecretStr = Field (title = "User’s password" , description = "User’s password" , examples = [ "@SuperSecret123" ] )
0 commit comments