generator-swiftserver
Version:
Generator for Kitura REST webservice servers
115 lines (100 loc) • 2.09 kB
YAML
swagger: '2.0'
info:
version: "0.0.1"
title: Products API
consumes:
- text/plain
produces:
- application/json
host: localhost:8080
paths:
/products:
get:
tags:
- products
operationId: getAll
description: Get all products
responses:
200:
$ref: '#/responses/getAllProducts'
post:
tags:
- products
operationId: add
description: Add new product
parameters:
- $ref: '#/parameters/productNameParam'
responses:
200:
$ref: '#/responses/getOneProduct'
/products/{id}:
get:
tags:
- products
operationId: get
description: Get product by ID
parameters:
- $ref: '#/parameters/idParam'
responses:
200:
$ref: '#/responses/getOneProduct'
delete:
tags:
- products
operationId: delete
description: Delete product by ID
parameters:
- $ref: '#/parameters/idParam'
responses:
200:
$ref: '#/responses/getOneProduct'
put:
tags:
- products
operationId: update
description: Update product by ID
parameters:
- $ref: '#/parameters/idParam'
- $ref: '#/parameters/productNameParam'
responses:
200:
$ref: '#/responses/getOneProduct'
definitions:
product:
type: object
description: A product object
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
responses:
getOneProduct:
description: One product
schema:
$ref: '#/definitions/product'
getAllProducts:
description: List of all products
schema:
type: array
items:
$ref: '#/definitions/product'
parameters:
idParam:
name: id
in: path
description: Product ID
required: true
type: integer
format: int64
productNameParam:
name: productName
in: body
description: Product name
required: true
schema:
type: string