-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathoas.yaml
485 lines (485 loc) · 13.9 KB
/
oas.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
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
openapi: 3.0.1
info:
title: Restful booker
description: An API for practising your testing skills
license:
name: 'License: GNU GPL'
url: https://github.com/texttest/restful-booker/blob/with_texttests/LICENSE
version: 2.0.0
servers:
- url: /
paths:
/ping:
get:
summary: ping HealthCheck
description: >-
A simple health check endpoint to confirm whether the API is up and
running.
responses:
'201':
description: successful operation
content:
application/json:
schema:
type: string
examples:
PING_SUCCESS:
value: success
/auth:
post:
summary: Get an authorization token
description: Get an authorization token
requestBody:
description: username and password
content:
application/json:
schema:
$ref: '#/components/schemas/AuthParams'
examples:
AUTH:
value:
username: admin2
password: password123
required: true
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/AuthResponse'
examples:
AUTH:
value:
token: abc123
reason: Login successful
'400':
description: unsuccessful operation
content:
text/plain:
schema:
type: string
x-codegen-request-body-name: body
/booking:
get:
summary: Get booking IDs
description: >-
Returns the ids of all the bookings that exist within the API. Can take
optional query strings to search and return a subset of booking ids.
parameters:
- name: firstname
in: query
description: Bookings with this firstname
schema:
type: string
examples:
GET_BOOKING_IDS:
value: Jim
GET_INVALID_CHECKIN_DATE:
value: (omit)
- name: lastname
in: query
description: Bookings with this lastname
schema:
type: string
examples:
GET_BOOKING_IDS:
value: Brown
GET_INVALID_CHECKIN_DATE:
value: (omit)
- name: checkin
in: query
description: >-
Bookings that have a checkin date greater than or equal to this
date. Format must be CCYY-MM-DD
schema:
type: string
format: date
pattern: '^\d{4}-\d{2}-\d{2}$'
examples:
GET_BOOKING_IDS:
value: 2018-01-01
GET_INVALID_CHECKIN_DATE:
value: 123
- name: checkout
in: query
description: >-
Bookings that have a checkout date greater than or equal to this
date. Format must be CCYY-MM-DD
schema:
type: string
format: date
pattern: '^\d{4}-\d{2}-\d{2}$'
examples:
GET_BOOKING_IDS:
value: 2019-01-01
GET_INVALID_CHECKIN_DATE:
value: (omit)
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/GetIdsResponse'
examples:
GET_BOOKING_IDS:
value:
- bookingid: 3
- bookingid: 4
- bookingid: 5
'400':
description: invalid request
content:
text/plain:
schema:
type: string
examples:
GET_INVALID_CHECKIN_DATE:
value: Invalid checkin date supplied
post:
summary: Create booking
description: Creates a new booking in the API
requestBody:
description: booking object
content:
application/json:
schema:
$ref: '#/components/schemas/Booking'
examples:
CREATE_BOOKING:
value:
firstname: Jim
lastname: Brown
totalprice: 111
depositpaid: true
bookingdates:
checkin: 2018-01-01
checkout: 2019-01-01
additionalneeds: Breakfast
required: true
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/BookingResponse'
examples:
CREATE_BOOKING:
value:
bookingid: 1
booking:
firstname: Jim
lastname: Brown
totalprice: 111
depositpaid: true
bookingdates:
checkin: 2018-01-01
checkout: 2019-01-01
additionalneeds: Breakfast
'400':
description: invalid request
content:
text/plain:
schema:
type: string
x-codegen-request-body-name: body
/booking/{id}:
get:
summary: Get booking
description: Returns a specific booking based upon the booking id provided
parameters:
- name: id
in: path
description: booking id to find
required: true
schema:
type: integer
examples:
GET_BOOKING:
value: 3
GET_INVALID_BOOKING_ID:
value: -1
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Booking'
examples:
GET_BOOKING:
value:
firstname: Jim
lastname: Brown
totalprice: 111
depositpaid: true
bookingdates:
checkin: 2018-01-01
checkout: 2019-01-01
additionalneeds: Breakfast
'404':
description: not found
content:
text/plain:
schema:
type: string
examples:
GET_INVALID_BOOKING_ID:
value: Invalid ID supplied
put:
summary: Update a booking
description: Update a booking
parameters:
- name: id
in: path
description: booking id to update
required: true
schema:
type: integer
examples:
UPDATE_BOOKING:
value: 8
- name: Authorization
in: header
description: >-
The authorization header. There is a secret value that only
application administrators know.
schema:
type: string
required: true
examples:
UPDATE_BOOKING:
value: Basic YWRtaW46cGFzc3dvcmQxMjM=
requestBody:
description: booking object
content:
application/json:
schema:
$ref: '#/components/schemas/Booking'
examples:
UPDATE_BOOKING:
value:
firstname: Mary
lastname: Jones
totalprice: 111
depositpaid: true
bookingdates:
checkin: 2018-01-01
checkout: 2019-01-01
additionalneeds: Breakfast
required: true
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Booking'
examples:
UPDATE_BOOKING:
value:
firstname: Mary
lastname: Jones
totalprice: 111
depositpaid: true
bookingdates:
checkin: 2018-01-01
checkout: 2019-01-01
additionalneeds: Breakfast
'400':
description: invalid request
content:
text/plain:
schema:
type: string
x-codegen-request-body-name: body
delete:
summary: Delete a booking
description: Delete a booking
parameters:
- name: id
in: path
description: Booking id that needs to be deleted
required: true
schema:
type: integer
examples:
DELETE_BOOKING:
value: 6
DELETE_INVALID_BOOKING_ID:
value: -1
- name: Authorization
in: header
description: >-
The authorization header. There is a secret value that only
application administrators know.
schema:
type: string
required: true
examples:
DELETE_BOOKING:
value: Basic YWRtaW46cGFzc3dvcmQxMjM=
DELETE_INVALID_BOOKING_ID:
value: Basic YWRtaW46cGFzc3dvcmQxMjM=
responses:
'201':
description: successful operation
content:
application/json:
schema:
type: string
examples:
DELETE_BOOKING:
value: Deleted
'404':
description: booking not found
content:
text/plain:
schema:
type: string
examples:
DELETE_INVALID_BOOKING_ID:
value: Invalid ID supplied
patch:
summary: Partially update a booking
description: Partially update a booking
parameters:
- name: id
in: path
description: booking id to update
required: true
schema:
type: integer
examples:
UPDATE_BOOKING:
value: 7
- name: Authorization
in: header
description: >-
The authorization header. There is a secret value that only
application administrators know.
schema:
type: string
required: true
examples:
UPDATE_BOOKING:
value: Basic YWRtaW46cGFzc3dvcmQxMjM=
requestBody:
description: booking object
content:
application/json:
schema:
$ref: '#/components/schemas/Booking'
examples:
UPDATE_BOOKING:
value:
firstname: Jim
lastname: Brown
totalprice: 111
depositpaid: true
bookingdates:
checkin: 2018-01-01
checkout: 2019-01-01
additionalneeds: Breakfast
required: true
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Booking'
examples:
UPDATE_BOOKING:
value:
firstname: Jim
lastname: Brown
totalprice: 111
depositpaid: true
bookingdates:
checkin: 2018-01-01
checkout: 2019-01-01
additionalneeds: Breakfast
'400':
description: invalid request
content:
text/plain:
schema:
type: string
x-codegen-request-body-name: body
components:
schemas:
GetIdsResponse:
type: object
properties:
bookingid:
type: integer
description: unique ID of the booking
description: The id of the booking
Booking:
type: object
required:
- firstname
- lastname
- bookingdates
- depositpaid
- totalprice
properties:
firstname:
type: string
description: First name of the guest who made the booking
lastname:
type: string
description: Last name for the guest who made the booking
totalprice:
type: integer
description: The total price for the booking
depositpaid:
type: boolean
description: Whether the deposit has been paid or not
bookingdates:
type: object
required:
- checkin
- checkout
properties:
checkin:
type: string
format: date
pattern: '^\d{4}-\d{2}-\d{2}$'
description: Date the guest is checking in
checkout:
type: string
format: date
pattern: '^\d{4}-\d{2}-\d{2}$'
description: Date the guest is checking out
additionalneeds:
type: string
description: Any other needs the guest has
description: Represents a hotel booking in the system.
BookingResponse:
type: object
properties:
bookingid:
type: integer
booking:
$ref: '#/components/schemas/Booking'
AuthParams:
type: object
properties:
username:
type: string
password:
type: string
AuthResponse:
type: object
properties:
token:
type: string
reason:
type: string
x-original-swagger-version: '2.0'