-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yml
272 lines (269 loc) · 9.15 KB
/
openapi.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
openapi: "3.0.3"
info:
title: GPTS - General Purpose Test Service
description: Description of available endpoints in application
version: "0.7.2"
externalDocs:
description: GPTS documentation
url: https://icikowski.github.io/GPTS
components:
schemas:
Response:
type: object
description: Method-specific response specification
properties:
status:
description: HTTP status code
type: integer
default: 200
contentType:
description: Value of "Content-Type" header
type: string
default: text/plain
content:
description: Content served as a response for request (text or base64-encoded binary)
type: string
default: ""
headers:
description: Map of headers added to the response for request
type: object
additionalProperties:
type: string
default: null
Route:
type: object
description: Declarative route configuration with specified responses (default and/or method-specific)
properties:
allowSubpaths:
description: Determines whether subpaths should be covered by given definition
type: boolean
default: false
default:
description: Default response defined for given route
$ref: '#/components/schemas/Response'
get:
description: Response for GET requests for given route
$ref: '#/components/schemas/Response'
post:
description: Response for POST requests for given route
$ref: '#/components/schemas/Response'
put:
description: Response for PUT requests for given route
$ref: '#/components/schemas/Response'
patch:
description: Response for PATCH requests for given route
$ref: '#/components/schemas/Response'
delete:
description: Response for DELETE requests for given route
$ref: '#/components/schemas/Response'
ErrorResponse:
type: object
description: Error response
properties:
status:
description: HTTP response error code
type: integer
message:
description: Short error summary
type: string
details:
description: Error details
type: string
required:
- status
- message
DefaultResponse:
type: object
description: Default response for paths without specific configuration
properties:
host:
description: Host to which incoming request was sent
type: string
path:
description: Path of incoming request
type: string
method:
description: Method of incoming request
type: string
headers:
description: Headers of incoming requests
type: object
additionalProperties:
type: string
queries:
description: Queries of incoming request
type: object
additionalProperties:
type: string
required:
- host
- path
- method
examples:
default_config:
value:
/hello:
allowSubpaths: true
default:
status: 200
contentType: application/json
content: "{\"message\":\"Hello World!\"}"
headers:
"X-SentBy": "GPTS - General Purpose Test Service"
extended_config:
value:
/page/favicon.png:
get:
contentType: image/png
content: base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAABvAAAAbwHxotxDAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAALdQTFRF//////8A//8A/9c8+883+9A3/9g7/9k8+c44+Mw2/9k6+Mw3+c43/9k798s198s2/tU698o2/9k798o29so1/9k7+c039cc19cc0PkNHQEVJQkdLXVtFd29DeHBDfHNEfnRDgnhDi39Cj4JCnIxBqpdArZlArppAsp1A1rk+6Mc88c488s8889A89MU09cg19dE898o2+Ms2+c43+tA4+9I4/NQ5/Nc7/dY7/dc7/dg7/tg6/9k74gqg4QAAABl0Uk5TAAECJkVGcICgr7O1tbW/wMHk5ujq9vv8/XpzYNYAAACySURBVBgZTcGJmoFgAIbRr6JozCCyzNhCdr+9GO/9X9ckzzOcowfH84PA9xw9WW5ILnRtZaxP/tUsSS4v95LkhLxpFeQBq3gDm3gF5w/5wOhnCtPvISR1BcCkO4d5dwKXtgJI0yWZZZpy6siH/p7cvs+hIQ9mY3LjWWK+5IT8RvEa1nF025mi5MJt0RsMeovr0ZQl2bU7sN2S7EzTVsYqtc7J5XQwpmzrqVCptzuNalGZP8XEJJiuHj/GAAAAAElFTkSuQmCC
/page:
get:
contentType: text/html
content: |
<!DOCTYPE html>
<html lang="pl">
<head>
<title>Sample page</title>
<meta charset="utf-8" />
<link rel="icon" type="image/png" href="favicon.png" />
</head>
<body>
<h1>Hello, visitor!</h1>
</body>
</html>
/contact:
get:
contentType: application/json
content: |
{
"name": "John Doe",
"email": "[email protected]",
"www": "https://example.com"
}
/:
get:
contentType: text/plain
content: "This is default response"
empty_config:
value: []
paths:
/config:
get:
summary: Retrieve current configuration
tags:
- Configuration
responses:
'200':
description: List of route configuration entries
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Route'
examples:
Default configuration:
$ref: '#/components/examples/default_config'
Extended configuration:
$ref: '#/components/examples/extended_config'
Empty configuration:
$ref: '#/components/examples/empty_config'
text/yaml:
schema:
type: array
items:
$ref: '#/components/schemas/Route'
examples:
Default configuration:
$ref: '#/components/examples/default_config'
Extended configuration:
$ref: '#/components/examples/extended_config'
Empty configuration:
$ref: '#/components/examples/empty_config'
post:
summary: Apply new configuration
tags:
- Configuration
requestBody:
description: List of route configuration entries
content:
application/json:
schema:
type: object
additionalProperties:
$ref: '#/components/schemas/Route'
examples:
Default configuration:
$ref: '#/components/examples/default_config'
Extended configuration:
$ref: '#/components/examples/extended_config'
Empty configuration:
$ref: '#/components/examples/empty_config'
text/yaml:
schema:
type: object
additionalProperties:
$ref: '#/components/schemas/Route'
examples:
Default configuration:
$ref: '#/components/examples/default_config'
Extended configuration:
$ref: '#/components/examples/extended_config'
Empty configuration:
$ref: '#/components/examples/empty_config'
responses:
'202':
description: Configuration accepted
'415':
description: Unsupported media type
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
status: 415
message: wrong media type (accepting application/json or text/yaml)
'400':
description: Configuration parsing error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
status: 400
message: configuration can't be parsed
details: some error from parser
/{path}:
get:
summary: Request to an unconfigured route
tags:
- Defaults
parameters:
- in: path
name: path
description: Unconfigured route path
required: true
allowEmptyValue: true
schema:
type: string
style: simple
example: a/b/c
responses:
'200':
description: Default response
content:
application/json:
schema:
$ref: '#/components/schemas/DefaultResponse'
example:
host: localhost
path: /a/b/c
method: GET
headers:
"X-Some-Sent-Header": "some value"
queries: {}
tags:
- name: Configuration
description: Always available configuration management endpoints; path may be changed to something different than "/config" using GPTS' configuration values
- name: Defaults
description: Responses for routes without configuration