Fix pydantic schemas integer validation
This commit is contained in:
parent
de1d79ff9f
commit
d44f5c732e
|
@ -1,28 +1,29 @@
|
||||||
from fastapi import Query
|
from fastapi import Query
|
||||||
from pydantic import BaseModel, EmailStr
|
from pydantic import BaseModel, EmailStr
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
class RegisterSchema(BaseModel):
|
class RegisterSchema(BaseModel):
|
||||||
full_name: str
|
full_name: str
|
||||||
email: EmailStr
|
email: EmailStr
|
||||||
password: str
|
password: str
|
||||||
gender: int = Query(None, le=1, ge=3)
|
gender: int = Query(None, ge=1, le=3)
|
||||||
mobile: str = Query(None, min_length=8, max_length=13)
|
mobile: str = Query(None, min_length=8, max_length=13)
|
||||||
user_image: str = None
|
user_image: Optional[str] = None
|
||||||
user_type: int = Query(None, le=1, ge=2)
|
user_type: int = Query(None, ge=1, le=2)
|
||||||
lang_type: int = Query(None, le=1, ge=2)
|
lang_type: int = Query(None, ge=1, le=2)
|
||||||
device_type: int = Query(None, le=1, ge=2)
|
device_type: int = Query(None, ge=1, le=2)
|
||||||
device_id: str
|
device_id: str
|
||||||
|
|
||||||
|
|
||||||
class LoginSchema(BaseModel):
|
class LoginSchema(BaseModel):
|
||||||
email: EmailStr
|
email: EmailStr
|
||||||
password: str
|
password: str
|
||||||
user_type: int = Query(None, le=1, ge=2)
|
user_type: int = Query(None, ge=1, le=2)
|
||||||
lang_type: int = Query(None, le=1, ge=2)
|
lang_type: int = Query(None, ge=1, le=2)
|
||||||
device_id: str
|
device_id: str
|
||||||
|
|
||||||
|
|
||||||
class OTPSchema(BaseModel):
|
class OTPSchema(BaseModel):
|
||||||
mobile: str = Query(None, min_length=8, max_length=13)
|
access_key: str
|
||||||
otp: int = Query(None, le=6, ge=6)
|
otp: int = Query(None, ge=6, le=6)
|
||||||
|
|
Loading…
Reference in New Issue