mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-24 16:07:30 +08:00
openapi: align response declarations with implementation (5 endpoints) (#14058)
* openapi: align response declarations with implementation (5 endpoints)
- POST /api/assets/download: replace 200 with 202 + tracking-task body
(endpoint runs asynchronously and returns task_id/status/message).
- POST /api/assets/export: same 200 → 202 + tracking-task body.
- POST /api/assets/from-workflow: change 201 → 200 (handler responds 200,
not 201; no Location header emitted).
- POST /api/feedback: change 200 → 201 (creates a feedback record).
- /api/jobs and /api/jobs/{job_id}: change timestamp fields from
type: number to type: integer + format: int64. Values are Unix
milliseconds — number causes oapi-codegen to emit float64, losing
precision and producing the wrong Go type. Affected fields:
create_time, update_time, execution_start_time, execution_end_time.
Verification: each change reflects what the endpoint observably returns;
no handler changes required. Backwards-compatible for existing clients
(integer is a subset of number; status code shifts within 2xx).
* openapi: align asset download/export 202 status enum with runtime + sibling schemas
CodeRabbit caught a vocabulary mismatch: the two new 202 response schemas
declared `[pending, running, completed, failed]` while the rest of the same
spec uses `[created, running, completed, failed]` for the identical task
lifecycle (download/export progress WebSocket events, /api/tasks, TaskEntry,
TaskResponse — 4 sites total). Cloud's runtime emits `created` on initial
creation (AssetDownloadResponseStatusCreated; task.Status sourced from the
DB enum whose initial value is Created). `pending` would have introduced a
fifth, contradictory vocabulary for the same lifecycle and pushed the spec
further from the implementation it is meant to align with.
Followup tracked separately: extract a shared TaskStatus enum so all five
sites move in lockstep instead of needing per-site edits.
This commit is contained in:
parent
1579bbb52d
commit
112fcd5f3b
70
openapi.yaml
70
openapi.yaml
@ -2342,16 +2342,27 @@ paths:
|
||||
$ref: "#/components/schemas/AssetDownloadRequest"
|
||||
description: Assets to download
|
||||
responses:
|
||||
"200":
|
||||
description: Download initiated
|
||||
"202":
|
||||
description: Download task accepted
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- task_id
|
||||
- status
|
||||
properties:
|
||||
task_id:
|
||||
type: string
|
||||
description: Task ID for tracking progress via WebSocket
|
||||
format: uuid
|
||||
description: ID of the download task; use to poll status.
|
||||
status:
|
||||
type: string
|
||||
enum: [created, running, completed, failed]
|
||||
description: Current task status (typically `created` on initial creation).
|
||||
message:
|
||||
type: string
|
||||
description: Human-readable task message.
|
||||
"400":
|
||||
description: Bad request
|
||||
content:
|
||||
@ -2391,17 +2402,27 @@ paths:
|
||||
type: string
|
||||
description: Name for the export archive
|
||||
responses:
|
||||
"200":
|
||||
description: Export initiated
|
||||
"202":
|
||||
description: Export task accepted
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- task_id
|
||||
- status
|
||||
properties:
|
||||
task_id:
|
||||
type: string
|
||||
export_name:
|
||||
format: uuid
|
||||
description: ID of the export task; use to poll status.
|
||||
status:
|
||||
type: string
|
||||
enum: [created, running, completed, failed]
|
||||
description: Current task status (typically `created` on initial creation).
|
||||
message:
|
||||
type: string
|
||||
description: Human-readable task message.
|
||||
"400":
|
||||
description: Bad request
|
||||
content:
|
||||
@ -2476,8 +2497,8 @@ paths:
|
||||
type: string
|
||||
description: Tags to apply to the created assets
|
||||
responses:
|
||||
"201":
|
||||
description: Assets created
|
||||
"200":
|
||||
description: Assets created or referenced
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
@ -5056,7 +5077,7 @@ paths:
|
||||
additionalProperties: true
|
||||
description: Additional context metadata
|
||||
responses:
|
||||
"200":
|
||||
"201":
|
||||
description: Feedback submitted
|
||||
content:
|
||||
application/json:
|
||||
@ -6102,14 +6123,17 @@ components:
|
||||
type: string
|
||||
description: Current job status
|
||||
create_time:
|
||||
type: number
|
||||
description: Job creation timestamp
|
||||
type: integer
|
||||
format: int64
|
||||
description: Job creation timestamp (Unix milliseconds).
|
||||
execution_start_time:
|
||||
type: number
|
||||
description: Workflow execution start timestamp
|
||||
type: integer
|
||||
format: int64
|
||||
description: Workflow execution start timestamp (Unix milliseconds, terminal states only).
|
||||
execution_end_time:
|
||||
type: number
|
||||
description: Workflow execution end timestamp
|
||||
type: integer
|
||||
format: int64
|
||||
description: Workflow execution end timestamp (Unix milliseconds, terminal states only).
|
||||
preview_output:
|
||||
type: object
|
||||
additionalProperties: true
|
||||
@ -6141,13 +6165,21 @@ components:
|
||||
execution_error:
|
||||
$ref: "#/components/schemas/ExecutionError"
|
||||
create_time:
|
||||
type: number
|
||||
type: integer
|
||||
format: int64
|
||||
description: Job creation timestamp (Unix milliseconds).
|
||||
update_time:
|
||||
type: number
|
||||
type: integer
|
||||
format: int64
|
||||
description: Last state-change timestamp (Unix milliseconds).
|
||||
execution_start_time:
|
||||
type: number
|
||||
type: integer
|
||||
format: int64
|
||||
description: Workflow execution start timestamp (Unix milliseconds, terminal states only).
|
||||
execution_end_time:
|
||||
type: number
|
||||
type: integer
|
||||
format: int64
|
||||
description: Workflow execution end timestamp (Unix milliseconds, terminal states only).
|
||||
preview_output:
|
||||
type: object
|
||||
additionalProperties: true
|
||||
|
||||
Loading…
Reference in New Issue
Block a user