109 lines
2.5 KiB
YAML
109 lines
2.5 KiB
YAML
openapi: 3.0.0
|
|
info:
|
|
version: 1.0.0
|
|
title: Items API
|
|
description: Template of API using items as an example
|
|
tags:
|
|
- name: itemsAPI
|
|
paths:
|
|
/items:
|
|
get:
|
|
operationId: getItems
|
|
description: Returns a list of items
|
|
tags:
|
|
- items
|
|
responses:
|
|
'200':
|
|
description: Successful response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/ItemDTO'
|
|
post:
|
|
operationId: postItem
|
|
description: Creates new item with the request content and ID set by server
|
|
tags:
|
|
- items
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ItemDTO'
|
|
responses:
|
|
'200':
|
|
description: Successful response
|
|
'400':
|
|
description: Bad request
|
|
/items/{itemId}:
|
|
get:
|
|
operationId: getItem
|
|
description: Returns item with given ID
|
|
parameters:
|
|
- name: itemId
|
|
in: path
|
|
description: ID of an item
|
|
required: true
|
|
schema:
|
|
type: long
|
|
tags:
|
|
- items
|
|
responses:
|
|
'200':
|
|
description: Successful response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ItemDTO'
|
|
'404':
|
|
description: Not found
|
|
put:
|
|
operationId: putItem
|
|
description: Creates new item or replaces target item with the request content
|
|
parameters:
|
|
- $ref: '#/components/parameters/itemId'
|
|
tags:
|
|
- items
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ItemDTO'
|
|
responses:
|
|
'200':
|
|
description: Successful response
|
|
'400':
|
|
description: Bad request
|
|
delete:
|
|
operationId: deleteItem
|
|
description: Deletes item with given ID
|
|
parameters:
|
|
- $ref: '#/components/parameters/itemId'
|
|
tags:
|
|
- items
|
|
responses:
|
|
'200':
|
|
description: Successful response
|
|
'404':
|
|
description: Not found
|
|
components:
|
|
schemas:
|
|
ItemDTO:
|
|
type: object
|
|
required:
|
|
- id
|
|
- name
|
|
properties:
|
|
id:
|
|
type: long
|
|
name:
|
|
type: string
|
|
parameters:
|
|
itemId:
|
|
name: itemId
|
|
in: path
|
|
description: ID of an item
|
|
required: true
|
|
schema:
|
|
type: long |