diff --git a/schemas/user.py b/schemas/user.py new file mode 100644 index 0000000..47d5777 --- /dev/null +++ b/schemas/user.py @@ -0,0 +1,25 @@ +from pydantic import BaseModel, Field +from typing import Optional + +class UserBase(BaseModel): + name: Optional[str] = Field(None, min_length=1, max_length=100, description="User's name") + +class UserCreate(UserBase): + class Config: + schema_extra = { + "example": { + "name": "John Doe" + } + } + +class User(UserBase): + id: int + + class Config: + orm_mode = True + schema_extra = { + "example": { + "id": 1, + "name": "John Doe" + } + } \ No newline at end of file