Newer
Older
openapi: 3.0.1
info:
title: Airport Manager
description: |
Microservice Application for Airport Manager
contact:
name: Martin Slovik
email: 540485@mail.muni.cz
# insert your information as well
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
version: "1.1"
servers:
- url: "{scheme}://{server}:{port}"
description: my server
variables:
scheme:
default: http
enum:
- http
- https
server:
default: localhost
port:
default: "8080"
tags:
- name: Core
description: Microservice for core.
paths:
/api/stewards:
get:
tags:
- Steward
summary: Get all stewards.
Returns an array of objects representing stewards.
operationId: getAllStewards
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/StewardDto'

Martin Slovík
committed
post:
tags:
- Steward
summary: Create a new steward.

Martin Slovík
committed
description: |
Creates a new steward and returns it as a response.

Martin Slovík
committed
operationId: createSteward
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/NewStewardDtoRequest'
required: true
responses:
"201":
$ref: '#/components/responses/SingleStewardDtoResponse'
"400":
description: Input data not correct

Martin Slovík
committed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
/api/stewards/{id}:
get:
tags:
- Steward

Martin Slovík
committed
summary: Get steward by id
description: Returns a steward by id.
operationId: getSteward
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/StewardDto'
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'

Martin Slovík
committed
delete:
tags:
- Steward
summary: Delete steward by id.

Martin Slovík
committed
operationId: deleteSteward
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
responses:
"204":
description: Deleted

Martin Slovík
committed
"404":
description: Not Found

Martin Slovík
committed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
put:
tags:
- Steward
summary: Update steward by id.
operationId: updateSteward
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
description: |
Updates a steward by id and returns it as a response.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/NewStewardDtoRequest'
required: true
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
responses:
"200":
$ref: '#/components/responses/SingleStewardDtoResponse'
"400":
description: Input data not correct
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
/api/stewards/{stewardId}/flights/{flightId}:
post:
tags:
- Steward
summary: Assign steward to a flight.
operationId: createStewardFlights
parameters:
- name: stewardId
in: path
required: true
schema:
type: integer
format: int64
- name: flightId
in: path
required: true
schema:
type: integer
format: int64
responses:
"201":
$ref: '#/components/responses/SingleStewardDtoResponse'
"400":
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
description: Input data not correct
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
put:
tags:
- Steward
summary: Update assignment of steward to a flight.
operationId: updateStewardFlights
parameters:
- name: stewardId
in: path
required: true
schema:
type: integer
format: int64
- name: flightId
in: path
required: true
schema:
type: integer
format: int64
responses:
"200":
$ref: '#/components/responses/SingleStewardDtoResponse'
"400":
description: Input data not correct
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
delete:
tags:
- Steward
summary: Delete assignment of steward to a flight.
operationId: deleteStewardFlights
parameters:
- name: stewardId
in: path
required: true
schema:
type: integer
format: int64
- name: flightId
in: path
required: true
schema:
type: integer
format: int64
responses:
"204":
description: Deleted
"404":
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
/api/stewards/paged:
get:
tags:
- Steward
summary: Paged stewards
description: |
Returns a page of stewards.
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
The parameter `page` specifies zero-based index of the requested page,
and the parameter `size` specifies the size of the page.
operationId: getStewardsPaged
parameters:
- name: page
in: query
description: Zero-based page index (0..N)
required: false
schema:
minimum: 0
type: integer
default: 0
- name: size
in: query
description: The size of the page to be returned
required: false
schema:
minimum: 1
type: integer
default: 20
- name: sort
in: query
description: "Sorting criteria in the format: property,(asc|desc). Default\
\ sort order is ascending. Multiple sort criteria are supported."
required: false
schema:
type: array
items:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PageStewardDto'
/api/flights:
get:
tags:
- Flight
summary: Get all flights.
Returns an array of objects representing flights.
operationId: getAllFlights
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/FlightDto'
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
post:
tags:
- Flight
summary: Create a new flight.
description: |
Creates a new flight and returns it as a response.
operationId: createFlight
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/NewFlightDtoRequest'
required: true
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/FlightDto'
"400":
description: Input data not correct
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
/api/flights/{id}:
get:
tags:
- Flight
summary: Get flight by id.
description: |
Returns an object representing a flight.
operationId: getFlightById
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/FlightDto'
delete:
tags:
- Flight
summary: Delete flight by id.
operationId: deleteFlight
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
responses:
"204":
description: Deleted
"404":
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
put:
tags:
- Flight
summary: Update flight by id.
operationId: updateFlight
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
description: Updates a flight by id and returns it as a response.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/NewFlightDtoRequest'
required: true
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/FlightDto'
"400":
description: Input data not correct
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
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
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
/api/airplaneTypes:
get:
tags:
- AirplaneType
summary: Get all airplane types.
description: |
Returns an array of objects representing airplane types.
operationId: getAllAirplaneTypes
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/AirplaneTypeDto'
post:
tags:
- AirplaneType
summary: Create a new airplane type.
description: Creates a new airplane type and returns it as a response.
operationId: createAirplaneType
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AirplaneTypeDto'
required: true
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/AirplaneTypeDto'
"400":
description: Input data not correct
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
/api/airplaneTypes/{id}:
get:
tags:
- AirplaneType
summary: Get airplane type by id.
description: Returns an object representing an airplane type.
operationId: getAirplaneTypeById
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AirplaneTypeDto'
delete:
tags:
- AirplaneType
summary: Delete airplane type by id.
operationId: deleteAirplaneType
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
responses:
"204":
description: Deleted
"404":
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
put:
tags:
- AirplaneType
summary: Update airplane type by id.
operationId: updateAirplaneType
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
description: Updates a airplane type by id and returns it as a response.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AirplaneTypeDto'
required: true
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AirplaneTypeDto'
"400":
description: Input data not correct
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
components:
schemas:
DomainEntity:
title: Domain Entity
description: Represents a Domain Entity
type: object
required:
- id
properties:
id:
type: integer
description: unique id
format: int64
example: 1
discriminator:
propertyName: objectType
ErrorMessage:
allOf:
- $ref: '#/components/schemas/DomainEntity'
title: Error Message
description: Response body for HTML statuses.
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
type: object
properties:
timestamp:
type: string
description: time in ISO format
format: date-time
example: 2022-12-21T18:52:10.757Z
status:
type: integer
description: HTTP status code
format: int32
example: 404
error:
type: string
description: HTTP status text
example: Not Found
message:
type: string
description: reason for error
example: entity not found
path:
type: string
description: URL path
example: /api/stewards/1
StewardDto:
allOf:
- $ref: '#/components/schemas/DomainEntity'
type: object
title: Steward
description: Represents a steward on a flight.
required:
- id
- firstName
- lastName
properties:
firstName:
type: string
description: first name of a steward
example: John
lastName:
type: string
description: last name of a steward
example: Doe

Martin Slovík
committed
flights:
type: array
description: flights assigned to a steward
items:
$ref: '#/components/schemas/FlightDto'
NewStewardDtoRequest:
type: object
title: New Steward Request
description: Object for requesting a new Steward.

Martin Slovík
committed
required:
- firstName
- lastName
properties:
firstName:
type: string
description: first name of a steward
example: John
lastName:
type: string
description: last name of a steward
example: Doe
FlightDto:
allOf:
- $ref: '#/components/schemas/DomainEntity'
type: object
title: Flight
description: Represents a flight.
required:
- id

Martin Slovík
committed
- departureTime
- arrivalTime
- stewards
- airplane
properties:
departureTime:
type: string
description: time of flight departure
format: date-time
example: 2022-12-22T12:04:04.493908908+01:00
arrivalTime:
type: string
description: time of flight arrival
format: date-time
example: 2022-12-22T12:04:04.493908908+01:00
stewards:
type: array
description: stewards assigned to a flight
items:
$ref: '#/components/schemas/StewardDto'
airplane:
$ref: '#/components/schemas/AirplaneDto'
NewFlightDtoRequest:
type: object
title: New Flight Request
description: Object for requesting a new Flight.
required:
- departureTime
- arrivalTime
properties:
departureTime:
type: string
description: time of flight departure
format: date-time
example: 2022-12-22T12:04:04.493908908+01:00
arrivalTime:
type: string
description: time of flight arrival
format: date-time
example: 2022-12-22T12:04:04.493908908+01:00

Martin Slovík
committed
AirplaneTypeDto:
allOf:
- $ref: '#/components/schemas/DomainEntity'
type: object
title: Airplane Type
description: Represents an Airplane Type.

Martin Slovík
committed
required:
- id
- name
properties:
name:
type: string
description: airplane type name
example: Boeing 747

Martin Slovík
committed
AirplaneDto:
allOf:
- $ref: '#/components/schemas/DomainEntity'
type: object
title: Airplane
description: Represents an Airplane.

Martin Slovík
committed
required:
- id
- name
- capacity
- type
properties:
name:
type: string
description: airplane name
example: Spitfire

Martin Slovík
committed
capacity:
type: integer
description: airplane seat capacity
format: int32
example: 150
type:
$ref: '#/components/schemas/AirplaneTypeDto'
type: object
title: Pageable Object
properties:
offset:
type: integer
format: int64
sort:
$ref: '#/components/schemas/SortObject'
pageSize:
type: integer
format: int32
pageNumber:
type: integer
format: int32
paged:
type: boolean
unpaged:
type: boolean
type: object
title: Sort Object
properties:
empty:
type: boolean
sorted:
type: boolean
unsorted:
type: boolean
PageStewardDto:
type: object
title: Paged Stewards
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
properties:
totalPages:
type: integer
format: int32
totalElements:
type: integer
format: int64
first:
type: boolean
last:
type: boolean
size:
type: integer
format: int32
content:
type: array
items:
$ref: '#/components/schemas/StewardDto'
number:
type: integer
format: int32
sort:
$ref: '#/components/schemas/SortObject'
numberOfElements:
type: integer
format: int32
pageable:
$ref: '#/components/schemas/PageableObject'
empty:
type: boolean
CountryDto:
allOf:
- $ref: '#/components/schemas/DomainEntity'
type: object
title: Country
description: Represents a country.
required:
- id
- name
properties:
name:
type: string
description: country name
example: Canada
CityDto:
allOf:
- $ref: '#/components/schemas/DomainEntity'
type: object
title: City
description: Represents a City in a Country containing Airports.
required:
- id
- name
properties:
name:
type: string
description: city name
example: New York, London
country:
$ref: '#/components/schemas/CountryDto'
airports:
type: array
items:
$ref: '#/components/schemas/AirplaneDto'
GPSLocationDto:
type: object
title: GPS Location
description: Represents a GPS Location of latitude and longitude.
required:
- latitude
- longitude
properties:
latitude:
type: number
format: double
example: 41.40338
longitude:
type: number
format: double
example: 2.17403
AirportDto:
allOf:
- $ref: '#/components/schemas/DomainEntity'
type: object
title: Airport
description: Represents an Airport.
required:
- id
- name
- code
- departingFlights
- arrivingFlights
- city
- location
properties:
name:
type: string
description: airport name
example: John F. Kennedy International Airport
code:
type: string
description: airport code in IATA format
example: JFK
departingFlights:
type: array
items:
$ref: '#/components/schemas/FlightDto'
arrivingFlights:
type: array
items:
$ref: '#/components/schemas/FlightDto'
city:
$ref: '#/components/schemas/CityDto'
location:
$ref: '#/components/schemas/GPSLocationDto'
responses:
SingleStewardDtoResponse:
description: Response containing a single Steward.
content:
application/json:
schema:
$ref: '#/components/schemas/StewardDto'
links:
link_to_getSteward:
operationId: getSteward
parameters:
id: $response.body#/id
description: |
The `id` value returned in the response can be used as
the `id` parameter in `GET /stewards/{id}`.