From d4f58a4c89347f60437d322db4af0ba2867713e7 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 26 Mar 2025 22:00:25 +0100 Subject: [PATCH] Add Dog schema --- schemas/dog.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 schemas/dog.py diff --git a/schemas/dog.py b/schemas/dog.py new file mode 100644 index 0000000..286be2a --- /dev/null +++ b/schemas/dog.py @@ -0,0 +1,27 @@ +from pydantic import BaseModel, Field +from typing import Optional + +class DogBase(BaseModel): + name: str = Field(..., description="Dog's name") + breed: str = Field(..., description="Dog's breed") + age: int = Field(..., gt=0, description="Dog's age in years") + owner_id: Optional[str] = Field(None, description="ID of the dog's owner") + + class Config: + schema_extra = { + "example": { + "name": "Buddy", + "breed": "Labrador", + "age": 5, + "owner_id": "123e4567-e89b-12d3-a456-426614174000" + } + } + +class DogCreate(DogBase): + pass + +class DogResponse(DogBase): + id: int + + class Config: + orm_mode = True \ No newline at end of file