debian-forge-composer/internal/worker/api/openapi.yml
Lars Karlitski ca35f25fcf worker/client: expose server errors
The worker API returns errors of the form:

  { "message": "..." }

Print the message of those errors when receiving an error on the client.

This adds an `Error` type to openapi.yml and marks all routes as
returning it on 4XX and 5XX.
2020-09-11 14:23:24 +01:00

190 lines
4.5 KiB
YAML

openapi: 3.0.0
info:
title: worker
version: '1.0'
servers: []
paths:
/status:
get:
summary: status
tags: []
responses:
'200':
description: OK
headers: {}
content:
application/json:
schema:
type: object
properties:
status:
type: string
enum:
- OK
required:
- status
4XX:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
5XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
operationId: GetStatus
description: Simple status handler to check whether the service is up.
/jobs:
post:
summary: Request a job
tags: []
responses:
'201':
description: Created
content:
application/json:
schema:
type: object
additionalProperties: false
properties:
manifest: {}
targets:
type: array
items: {}
location:
type: string
artifact_location:
type: string
id:
type: string
format: uuid
required:
- manifest
- location
- id
4XX:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
5XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
operationId: RequestJob
requestBody:
content:
application/json:
schema:
type: object
additionalProperties: false
description: ''
description: Requests a job. This operation blocks until a job is available.
parameters: []
'/jobs/{token}':
parameters:
- schema:
type: string
name: token
in: path
required: true
get:
summary: Get running job
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
canceled:
type: boolean
required:
- canceled
4XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
5XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
operationId: GetJob
description: ''
patch:
summary: Update a running job
tags: []
responses: {}
operationId: UpdateJob
requestBody:
content:
application/json:
schema:
type: object
properties:
status:
type: string
enum:
- WAITING
- RUNNING
- FINISHED
- FAILED
result: {}
required:
- status
- result
'/jobs/{token}/artifacts/{name}':
parameters:
- schema:
type: string
name: name
in: path
required: true
- schema:
type: string
name: token
in: path
required: true
put:
summary: Upload an artifact
tags: []
responses:
'200':
description: OK
4XX:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
5XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
operationId: UploadJobArtifact
requestBody:
content:
application/octet-stream:
schema:
type: string
components:
schemas:
Error:
title: Error
type: object
properties:
message:
type: string
required:
- message