You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
microsrv/swagger.yml

192 lines
4.9 KiB
YAML

basePath: /
consumes:
- application/json
definitions:
GenericError:
description: GenericError GenericError GenericError GenericError GenericError
is a generic error message returned by the server
properties:
message:
description: message
type: string
x-go-name: Message
type: object
x-go-package: microsrv/client/models
Product:
description: Product Product Product Product product
properties:
desc:
description: the description for the coffee
maxLength: 10000
type: string
x-go-name: Desc
id:
description: the id for the coffee
format: int64
minimum: 1
type: integer
x-go-name: ID
name:
description: the name for the coffee
maxLength: 255
type: string
x-go-name: Name
price:
description: the price for the coffee
format: float
minimum: 0.01
type: number
x-go-name: Price
sku:
description: the SKU for the coffee
pattern: cof-[a-z]+
type: string
x-go-name: SKU
required:
- id
- name
- price
- sku
type: object
x-go-package: microsrv/client/models
ValidationError:
description: ValidationError ValidationError ValidationError ValidationError ValidationError
is a collection of validation error messages
properties:
messages:
description: messages
items:
type: string
type: array
x-go-name: Messages
type: object
x-go-package: microsrv/client/models
info:
description: Documentation for Product API
title: of Product API
version: 0.0.1
paths:
/products:
get:
description: Return a list of products from the data store
operationId: getProducts
responses:
"200":
$ref: '#/responses/productsResponse'
tags:
- products
post:
description: Create a new product
operationId: addProduct
parameters:
- description: |-
Product data structure to Update or Add.
Note: the id field is ignored by update and create operations
in: body
name: Body
required: true
schema:
$ref: '#/definitions/Product'
responses:
"200":
$ref: '#/responses/productResponse'
"422":
$ref: '#/responses/errorValidation'
"501":
$ref: '#/responses/errorResponse'
tags:
- products
put:
description: Replaces one product
operationId: updateProduct
responses:
"201":
$ref: '#/responses/noContentResponse'
"404":
$ref: '#/responses/errorResponse'
"422":
$ref: '#/responses/errorValidation'
tags:
- products
/products/{id}:
delete:
description: Update a products details
operationId: deleteProduct
parameters:
- description: |-
Product data structure to Update or Add.
Note: the id field is ignored by update and create operations
in: body
name: Body
required: true
schema:
$ref: '#/definitions/Product'
- description: The id of the product that is operated on
format: int64
in: path
name: id
required: true
type: integer
x-go-name: ID
responses:
"201":
$ref: '#/responses/noContentResponse'
"404":
$ref: '#/responses/errorResponse'
"501":
$ref: '#/responses/errorResponse'
tags:
- products
get:
description: Return a single product from the data store
operationId: getProduct
parameters:
- description: |-
Product data structure to Update or Add.
Note: the id field is ignored by update and create operations
in: body
name: Body
required: true
schema:
$ref: '#/definitions/Product'
- description: The id of the product that is operated on
format: int64
in: path
name: id
required: true
type: integer
x-go-name: ID
responses:
"200":
$ref: '#/responses/productResponse'
"404":
$ref: '#/responses/errorResponse'
tags:
- products
produces:
- application/json
responses:
errorResponse:
description: Generic error message returned as a string
schema:
$ref: '#/definitions/GenericError'
errorValidation:
description: Validation errors defined as an array of strings
schema:
$ref: '#/definitions/ValidationError'
noContentResponse:
description: No content is returned by this API endpoint
productResponse:
description: Data structure representing a single product
schema:
$ref: '#/definitions/Product'
productsResponse:
description: A list of products
schema:
items:
$ref: '#/definitions/Product'
type: array
schemes:
- http
swagger: "2.0"