from pydantic import BaseModel, Field from typing import Optional class CityBase(BaseModel): name: str = Field(..., min_length=1, max_length=100, description="City name") endpoint: str = Field(..., min_length=1, max_length=200, description="City endpoint") description: Optional[str] = Field(None, description="City description") is_active: bool = Field(default=True, description="City active status") class CityCreate(CityBase): class Config: schema_extra = { "example": { "name": "New York", "endpoint": "/new-york", "description": "The Big Apple", "is_active": True } } class City(CityBase): id: int = Field(..., description="City ID") class Config: orm_mode = True schema_extra = { "example": { "id": 1, "name": "New York", "endpoint": "/new-york", "description": "The Big Apple", "is_active": True } }