-
Notifications
You must be signed in to change notification settings - Fork 1
/
swagger.yaml
190 lines (190 loc) · 6.36 KB
/
swagger.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
basePath: /
consumes:
- application/json
definitions:
GenericError:
description: GenericError GenericError GenericError is a generic error message returned by a server
properties:
message:
description: message
type: string
x-go-name: Message
type: object
x-go-package: github.com/piyush1146115/go-microservice/product-api/sdk/models
Product:
description: |-
Product Product Product defines the structure for an API product
swagger: model
properties:
description:
description: description
type: string
x-go-name: Description
id:
description: the id for this model
format: int64
minimum: 1
type: integer
x-go-name: ID
name:
description: name
type: string
x-go-name: Name
price:
description: price
format: float
type: number
x-go-name: Price
sku:
description: s k u
type: string
x-go-name: SKU
required:
- id
type: object
x-go-package: github.com/piyush1146115/go-microservice/product-api/sdk/models
ValidationError:
description: 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: github.com/piyush1146115/go-microservice/product-api/sdk/models
info:
description: Documentation for Product API
title: of Product API
version: 1.0.0
paths:
/products:
get:
description: Return a list of products from the database
operationId: listProducts
parameters:
- description: |-
Currency used when returning the price of the product,
when not specified currency is returned in GBP.
in: query
name: Currency
type: string
responses:
"200":
$ref: '#/responses/productsResponse'
tags:
- products
post:
description: Create a new product
operationId: createProduct
parameters:
- description: |-
Product data structure to Update or Create.
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: Update a products details
operationId: updateProduct
parameters:
- description: |-
Product data structure to Update or Create.
Note: the id field is ignored by update and create operations
in: body
name: Body
required: true
schema:
$ref: '#/definitions/Product'
responses:
"201":
$ref: '#/responses/noContentResponse'
"404":
$ref: '#/responses/errorResponse'
"422":
$ref: '#/responses/errorValidation'
tags:
- products
/products/{id}:
delete:
description: Returns a list of products
operationId: deleteProduct
parameters:
- description: The id of the product for which the operation relates
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 list of products from the database
operationId: listSingleProduct
parameters:
- description: |-
Currency used when returning the price of the product,
when not specified currency is returned in GBP.
in: query
name: Currency
type: string
- description: The id of the product for which the operation relates
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"