[refactor] Use Pydantic models for query parameter validation

- Added query parameter models to OpenAPI spec for GET endpoints
- Regenerated data models to include new query param models
- Replaced manual validation with Pydantic model validation
- Removed obsolete validate_required_params helper function
- Provides better error messages and type safety for API endpoints

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
bymyself
2025-06-17 14:42:25 -07:00
parent f1b3c6b735
commit a4bf6bddbf
4 changed files with 111 additions and 54 deletions

View File

@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-17T20:27:16+00:00
# timestamp: 2025-06-17T21:37:15+00:00
from __future__ import annotations
@@ -252,6 +252,33 @@ class EnablePackParams(BaseModel):
)
class UpdateAllQueryParams(BaseModel):
client_id: str = Field(
..., description='Client identifier that initiated the request'
)
ui_id: str = Field(..., description='Base UI identifier for task tracking')
mode: Optional[ManagerDatabaseSource] = None
class UpdateComfyUIQueryParams(BaseModel):
client_id: str = Field(
..., description='Client identifier that initiated the request'
)
ui_id: str = Field(..., description='UI identifier for task tracking')
stable: Optional[bool] = Field(
True,
description='Whether to update to stable version (true) or nightly (false)',
)
class ComfyUISwitchVersionQueryParams(BaseModel):
ver: str = Field(..., description='Version to switch to')
client_id: str = Field(
..., description='Client identifier that initiated the request'
)
ui_id: str = Field(..., description='UI identifier for task tracking')
class QueueStatus(BaseModel):
total_count: int = Field(
..., description='Total number of tasks (pending + running)'