[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:
@@ -49,6 +49,9 @@ from .generated_models import (
|
||||
UninstallPackParams,
|
||||
DisablePackParams,
|
||||
EnablePackParams,
|
||||
UpdateAllQueryParams,
|
||||
UpdateComfyUIQueryParams,
|
||||
ComfyUISwitchVersionQueryParams,
|
||||
QueueStatus,
|
||||
ManagerMappings,
|
||||
ModelMetadata,
|
||||
@@ -104,6 +107,9 @@ __all__ = [
|
||||
"UninstallPackParams",
|
||||
"DisablePackParams",
|
||||
"EnablePackParams",
|
||||
"UpdateAllQueryParams",
|
||||
"UpdateComfyUIQueryParams",
|
||||
"ComfyUISwitchVersionQueryParams",
|
||||
"QueueStatus",
|
||||
"ManagerMappings",
|
||||
"ModelMetadata",
|
||||
|
||||
@@ -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)'
|
||||
|
||||
Reference in New Issue
Block a user