-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yml
188 lines (188 loc) · 4.66 KB
/
swagger.yml
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
swagger: '2.0'
info:
version: 1.0.0
title: Typescript Node Api
basePath: "/api"
tags:
- name: Product Categories
consumes:
- application/json
produces:
- application/json
paths:
/v1/product-categories:
get:
summary: Retrieve a list of product categories
tags:
- Product Categories
parameters:
- name: offset
in: query
description: The first result to return
type: integer
default: 0
- name: limit
in: query
description: The amount of results to return
type: integer
default : 25
responses:
200:
description: OK
headers:
x-request-id:
description: The request identifier
type: string
schema:
type: object
properties:
items:
type: array
items:
$ref: '#/definitions/ProductCategoryResource'
total:
type: integer
description: The total amount of records found
offset:
type: integer
description: The first result to return
limit:
type: integer
description: The amount of records to return
400:
$ref: '#/components/responses/BadRequest'
post:
summary: Create a new product category
tags:
- Product Categories
parameters:
- in: body
name: body
required: true
schema:
"$ref": "#/definitions/ProductCategoryResource"
responses:
201:
description: Created
headers:
x-request-id:
description: The request identifier
type: string
schema:
$ref: '#/definitions/ProductCategoryResource'
400:
$ref: '#/components/responses/BadRequest'
409:
$ref: '#/components/responses/Conflict'
/v1/product-categories/{id}:
get:
summary: Retrieve a single product category
tags:
- Product Categories
parameters:
- name: id
in: path
description: The resource identifier
required: true
type: string
responses:
200:
description: OK
headers:
x-request-id:
description: The request identifier
type: string
schema:
type: object
$ref: '#/definitions/ProductCategoryResource'
400:
$ref: '#/components/responses/BadRequest'
404:
$ref: '#/components/responses/NotFound'
definitions:
ProductCategoryResource:
properties:
id:
type: string
example: 59de80da99e5f90280ee3e24
readOnly: true
code:
type: string
example: MOBPHO
name:
type: string
example: Mobile Phones
description:
type: string
example: Everything concerning mobile phones
required:
- code
- name
ValidationResultItem:
properties:
message:
type: string
example: field is required
path:
type: array
example:
- body
- field
items:
type: string
components:
responses:
BadRequest:
description: Bad Request
allOf:
- $ref: '#/components/schemas/StatusError'
- type: object
properties:
data:
type: array
items:
$ref: '#/definitions/ValidationResultItem'
examples:
application/json:
statusCode: 400
error: Bad Request
message: Bad Request
Conflict:
description: Unauthorized
schema:
$ref: '#/components/schemas/StatusError'
examples:
application/json:
statusCode: 409
error: Conflict
message: The 'Resource' already exists (code:'XX')
NotFound:
description: Not Found
schema:
$ref: '#/components/schemas/StatusError'
examples:
application/json:
statusCode: 404
error: Not Found
message: The 'Resource' is not found
Unauthorized:
description: Unauthorized
schema:
$ref: '#/components/schemas/StatusError'
Forbidden:
description: Forbidden
schema:
$ref: '#/components/schemas/StatusError'
schemas:
StatusError:
type: object
properties:
statusCode:
type: integer
error:
type: string
message:
type: string
required:
- statusCode
- error