from pydantic import BaseModel, Field from typing import Optional class CategoryBase(BaseModel): name: str = Field(..., min_length=1, max_length=100, description="Name of the category") description: Optional[str] = Field(None, description="Description of the category") class CategoryCreate(CategoryBase): pass class CategoryResponse(CategoryBase): id: int class Config: from_attributes = True