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:
Matt Miller 2026-05-22 14:31:43 -07:00 committed by GitHub
parent 1579bbb52d
commit 112fcd5f3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2342,16 +2342,27 @@ paths:
$ref: "#/components/schemas/AssetDownloadRequest" $ref: "#/components/schemas/AssetDownloadRequest"
description: Assets to download description: Assets to download
responses: responses:
"200": "202":
description: Download initiated description: Download task accepted
content: content:
application/json: application/json:
schema: schema:
type: object type: object
required:
- task_id
- status
properties: properties:
task_id: task_id:
type: string 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": "400":
description: Bad request description: Bad request
content: content:
@ -2391,17 +2402,27 @@ paths:
type: string type: string
description: Name for the export archive description: Name for the export archive
responses: responses:
"200": "202":
description: Export initiated description: Export task accepted
content: content:
application/json: application/json:
schema: schema:
type: object type: object
required:
- task_id
- status
properties: properties:
task_id: task_id:
type: string type: string
export_name: format: uuid
description: ID of the export task; use to poll status.
status:
type: string 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": "400":
description: Bad request description: Bad request
content: content:
@ -2476,8 +2497,8 @@ paths:
type: string type: string
description: Tags to apply to the created assets description: Tags to apply to the created assets
responses: responses:
"201": "200":
description: Assets created description: Assets created or referenced
content: content:
application/json: application/json:
schema: schema:
@ -5056,7 +5077,7 @@ paths:
additionalProperties: true additionalProperties: true
description: Additional context metadata description: Additional context metadata
responses: responses:
"200": "201":
description: Feedback submitted description: Feedback submitted
content: content:
application/json: application/json:
@ -6102,14 +6123,17 @@ components:
type: string type: string
description: Current job status description: Current job status
create_time: create_time:
type: number type: integer
description: Job creation timestamp format: int64
description: Job creation timestamp (Unix milliseconds).
execution_start_time: execution_start_time:
type: number type: integer
description: Workflow execution start timestamp format: int64
description: Workflow execution start timestamp (Unix milliseconds, terminal states only).
execution_end_time: execution_end_time:
type: number type: integer
description: Workflow execution end timestamp format: int64
description: Workflow execution end timestamp (Unix milliseconds, terminal states only).
preview_output: preview_output:
type: object type: object
additionalProperties: true additionalProperties: true
@ -6141,13 +6165,21 @@ components:
execution_error: execution_error:
$ref: "#/components/schemas/ExecutionError" $ref: "#/components/schemas/ExecutionError"
create_time: create_time:
type: number type: integer
format: int64
description: Job creation timestamp (Unix milliseconds).
update_time: update_time:
type: number type: integer
format: int64
description: Last state-change timestamp (Unix milliseconds).
execution_start_time: execution_start_time:
type: number type: integer
format: int64
description: Workflow execution start timestamp (Unix milliseconds, terminal states only).
execution_end_time: execution_end_time:
type: number type: integer
format: int64
description: Workflow execution end timestamp (Unix milliseconds, terminal states only).
preview_output: preview_output:
type: object type: object
additionalProperties: true additionalProperties: true