Skip to content

Commit 112fcd5

Browse files
authored
openapi: align response declarations with implementation (5 endpoints) (Comfy-Org#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.
1 parent 1579bbb commit 112fcd5

1 file changed

Lines changed: 51 additions & 19 deletions

File tree

openapi.yaml

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2342,16 +2342,27 @@ paths:
23422342
$ref: "#/components/schemas/AssetDownloadRequest"
23432343
description: Assets to download
23442344
responses:
2345-
"200":
2346-
description: Download initiated
2345+
"202":
2346+
description: Download task accepted
23472347
content:
23482348
application/json:
23492349
schema:
23502350
type: object
2351+
required:
2352+
- task_id
2353+
- status
23512354
properties:
23522355
task_id:
23532356
type: string
2354-
description: Task ID for tracking progress via WebSocket
2357+
format: uuid
2358+
description: ID of the download task; use to poll status.
2359+
status:
2360+
type: string
2361+
enum: [created, running, completed, failed]
2362+
description: Current task status (typically `created` on initial creation).
2363+
message:
2364+
type: string
2365+
description: Human-readable task message.
23552366
"400":
23562367
description: Bad request
23572368
content:
@@ -2391,17 +2402,27 @@ paths:
23912402
type: string
23922403
description: Name for the export archive
23932404
responses:
2394-
"200":
2395-
description: Export initiated
2405+
"202":
2406+
description: Export task accepted
23962407
content:
23972408
application/json:
23982409
schema:
23992410
type: object
2411+
required:
2412+
- task_id
2413+
- status
24002414
properties:
24012415
task_id:
24022416
type: string
2403-
export_name:
2417+
format: uuid
2418+
description: ID of the export task; use to poll status.
2419+
status:
2420+
type: string
2421+
enum: [created, running, completed, failed]
2422+
description: Current task status (typically `created` on initial creation).
2423+
message:
24042424
type: string
2425+
description: Human-readable task message.
24052426
"400":
24062427
description: Bad request
24072428
content:
@@ -2476,8 +2497,8 @@ paths:
24762497
type: string
24772498
description: Tags to apply to the created assets
24782499
responses:
2479-
"201":
2480-
description: Assets created
2500+
"200":
2501+
description: Assets created or referenced
24812502
content:
24822503
application/json:
24832504
schema:
@@ -5056,7 +5077,7 @@ paths:
50565077
additionalProperties: true
50575078
description: Additional context metadata
50585079
responses:
5059-
"200":
5080+
"201":
50605081
description: Feedback submitted
50615082
content:
50625083
application/json:
@@ -6102,14 +6123,17 @@ components:
61026123
type: string
61036124
description: Current job status
61046125
create_time:
6105-
type: number
6106-
description: Job creation timestamp
6126+
type: integer
6127+
format: int64
6128+
description: Job creation timestamp (Unix milliseconds).
61076129
execution_start_time:
6108-
type: number
6109-
description: Workflow execution start timestamp
6130+
type: integer
6131+
format: int64
6132+
description: Workflow execution start timestamp (Unix milliseconds, terminal states only).
61106133
execution_end_time:
6111-
type: number
6112-
description: Workflow execution end timestamp
6134+
type: integer
6135+
format: int64
6136+
description: Workflow execution end timestamp (Unix milliseconds, terminal states only).
61136137
preview_output:
61146138
type: object
61156139
additionalProperties: true
@@ -6141,13 +6165,21 @@ components:
61416165
execution_error:
61426166
$ref: "#/components/schemas/ExecutionError"
61436167
create_time:
6144-
type: number
6168+
type: integer
6169+
format: int64
6170+
description: Job creation timestamp (Unix milliseconds).
61456171
update_time:
6146-
type: number
6172+
type: integer
6173+
format: int64
6174+
description: Last state-change timestamp (Unix milliseconds).
61476175
execution_start_time:
6148-
type: number
6176+
type: integer
6177+
format: int64
6178+
description: Workflow execution start timestamp (Unix milliseconds, terminal states only).
61496179
execution_end_time:
6150-
type: number
6180+
type: integer
6181+
format: int64
6182+
description: Workflow execution end timestamp (Unix milliseconds, terminal states only).
61516183
preview_output:
61526184
type: object
61536185
additionalProperties: true

0 commit comments

Comments
 (0)