161 lines
3.5 KiB
YAML
161 lines
3.5 KiB
YAML
openapi: 3.0.3
|
|
info:
|
|
title: Item API
|
|
version: 0.1.0
|
|
paths:
|
|
/items:
|
|
get:
|
|
operationId: list_items
|
|
summary: List items
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: "#/components/schemas/Item"
|
|
post:
|
|
operationId: create_item
|
|
summary: Create an item
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/ItemInput"
|
|
responses:
|
|
"201":
|
|
description: Created
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Item"
|
|
/items/{id}:
|
|
get:
|
|
operationId: get_item
|
|
summary: Get an item
|
|
parameters:
|
|
- name: id
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Item"
|
|
"404":
|
|
description: Not found
|
|
delete:
|
|
operationId: delete_item
|
|
summary: Delete an item
|
|
parameters:
|
|
- name: id
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Deleted
|
|
"404":
|
|
description: Not found
|
|
/jobs:
|
|
get:
|
|
operationId: list_jobs
|
|
summary: List jobs
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: "#/components/schemas/Job"
|
|
post:
|
|
operationId: create_job
|
|
summary: Create a job
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/JobInput"
|
|
responses:
|
|
"201":
|
|
description: Created
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Job"
|
|
/jobs/{id}:
|
|
get:
|
|
operationId: get_job
|
|
summary: Get a job
|
|
parameters:
|
|
- name: id
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Job"
|
|
"404":
|
|
description: Not found
|
|
components:
|
|
schemas:
|
|
Item:
|
|
type: object
|
|
required: [name, quantity]
|
|
properties:
|
|
id:
|
|
type: string
|
|
name:
|
|
type: string
|
|
quantity:
|
|
type: integer
|
|
ItemInput:
|
|
type: object
|
|
required: [name]
|
|
properties:
|
|
name:
|
|
type: string
|
|
quantity:
|
|
type: integer
|
|
default: 1
|
|
Job:
|
|
type: object
|
|
required: [name, status]
|
|
properties:
|
|
id:
|
|
type: string
|
|
name:
|
|
type: string
|
|
status:
|
|
type: string
|
|
enum: [pending, processing, done, failed]
|
|
retry_count:
|
|
type: integer
|
|
error_message:
|
|
type: string
|
|
payload:
|
|
type: object
|
|
JobInput:
|
|
type: object
|
|
required: [name]
|
|
properties:
|
|
name:
|
|
type: string
|
|
payload:
|
|
type: object |