40 lines
785 B
Python
40 lines
785 B
Python
|
|
"""Common schemas used across the API."""
|
||
|
|
|
||
|
|
from typing import Generic, Optional, TypeVar
|
||
|
|
|
||
|
|
from pydantic import BaseModel
|
||
|
|
|
||
|
|
T = TypeVar("T")
|
||
|
|
|
||
|
|
|
||
|
|
class HealthResponse(BaseModel):
|
||
|
|
"""Health check response schema."""
|
||
|
|
|
||
|
|
status: str
|
||
|
|
version: str
|
||
|
|
|
||
|
|
|
||
|
|
class InstanceMetaResponse(BaseModel):
|
||
|
|
"""
|
||
|
|
Instance metadata response.
|
||
|
|
|
||
|
|
This endpoint is stable even before tenant bootstrap completes.
|
||
|
|
Used for diagnostics and instance identification.
|
||
|
|
"""
|
||
|
|
|
||
|
|
instance_id: Optional[str] = None
|
||
|
|
local_mode: bool
|
||
|
|
version: str
|
||
|
|
tenant_id: Optional[str] = None
|
||
|
|
bootstrap_status: dict
|
||
|
|
|
||
|
|
|
||
|
|
class PaginatedResponse(BaseModel, Generic[T]):
|
||
|
|
"""Generic paginated response wrapper."""
|
||
|
|
|
||
|
|
items: list[T]
|
||
|
|
total: int
|
||
|
|
page: int
|
||
|
|
page_size: int
|
||
|
|
total_pages: int
|