master/adapter/http/fastapi/schemas.py
Azamat e629e34c4d ref #10: [fix] enforce UUID chat ids
Normalize chat ids to a single UUID form so locks, repository keys, and mount paths cannot diverge through path-like aliases.
2026-04-02 22:35:50 +03:00

33 lines
676 B
Python

from datetime import datetime
from uuid import UUID
from pydantic import BaseModel, ConfigDict, Field, field_validator
class HealthResponse(BaseModel):
status: str
app: str
env: str
class CreateSandboxRequest(BaseModel):
model_config = ConfigDict(extra='forbid', str_strip_whitespace=True)
chat_id: str = Field(min_length=1)
@field_validator('chat_id')
@classmethod
def validate_chat_id(cls, value: str) -> str:
return str(UUID(value))
class SandboxSessionResponse(BaseModel):
session_id: str
chat_id: str
container_id: str
status: str
expires_at: datetime
class ErrorResponse(BaseModel):
detail: str