From ca69ff0674a1505020661451f2743717a9376399 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 26 Mar 2025 14:32:30 +0000 Subject: [PATCH] Add User schema --- schemas/user.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 schemas/user.py 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