-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
701 lines (698 loc) · 21.7 KB
/
openapi.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
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
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
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
openapi: 3.0.0
servers:
- url: http://localhost:5080
description: Local REST server
- url: grpc://localhost:5111
description: Local gRPC server
info:
version: "1.0.0"
title: Open European Public Transit Format (OEPTF)
contact:
email: tristan.marsell@axitera.de
license:
name: BSD-3-Clause
url: 'https://opensource.org/licenses/BSD-3-Clause'
description: 'An european standard for public transit. Made for flexibility, future proof and european public transit. Works perfectly with REST and gRPC.'
tags:
- name: Trip
description: Trip search endpoints
- name: Timetable
description: Timetable search endpoints
- name: Place
description: Place search endpoints
paths:
/trip/{source}:
post:
tags:
- Trip
description: "Creates a tripsearch instance and searches for your given parameters to the Search body"
parameters:
- in: path
name: source
required: true
schema:
type: string
description: Data source to be selected on.
requestBody:
description: "Request body of the trip search"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Search'
responses:
'200':
description: "search results matching criteria"
content:
application/json:
schema:
$ref: '#/components/schemas/TripResult'
application/x-protobuf:
schema:
$ref: '#/components/schemas/TripResult'
'500':
description: "Something failed in search"
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/trip/more/{source}:
post:
tags:
- Trip
description: "Creates an additional tripsearch depending on the context of your current tripsearch"
parameters:
- in: path
name: source
required: true
schema:
type: string
description: Data source to be selected on.
requestBody:
description: "Request body of the trip more search"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MoreTripsSearch'
responses:
'200':
description: "search results matching criteria"
content:
application/json:
schema:
$ref: '#/components/schemas/TripResult'
application/x-protobuf:
schema:
$ref: '#/components/schemas/TripResult'
'500':
description: "Something failed in search"
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/timetable/{source}:
post:
tags:
- Timetable
description: "Creates a timetable instance and obtains stopovers for your given parameters to the TimetableSearch body"
parameters:
- in: path
name: source
required: true
schema:
type: string
description: Data source to be selected on.
requestBody:
description: "Request body of the timetable request"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TimetableSearch'
responses:
'200':
description: "timetable body is valid and timetable was found"
content:
application/json:
schema:
$ref: '#/components/schemas/Timetable'
application/x-protobuf:
schema:
$ref: '#/components/schemas/Timetable'
'500':
description: "Something failed in getting the timetable"
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/timetable/suggestions/{source}:
post:
tags:
- Timetable
description: "Creates a timetable instance containing suggested timetables with their information"
parameters:
- in: path
name: source
required: true
schema:
type: string
description: Data source to be selected on.
requestBody:
description: "Request body of the timetable request"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TimetableSearch'
responses:
'200':
description: "timetable body is valid and timetable suggestions were found"
content:
application/json:
schema:
$ref: '#/components/schemas/TimetableSuggestions'
'500':
description: "Something failed in getting the timetable"
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/place/search/{source}:
get:
tags:
- Place
description: "Searches for places given to the query"
parameters:
- in: path
name: source
required: true
schema:
type: string
description: Data source to be selected on.
- in: query
name: query
required: true
schema:
type: string
responses:
'200':
description: "Query is valid and locations exi"
content:
application/json:
schema:
$ref: '#/components/schemas/PlaceResult'
application/x-protobuf:
schema:
$ref: '#/components/schemas/PlaceResult'
'500':
description: "Something failed in getting the places"
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/place/nearby/{source}:
get:
tags:
- Place
description: "Searches for places given to the coordinates"
parameters:
- in: path
name: source
required: true
schema:
type: string
description: Data source to be selected on.
- in: query
name: latitude
required: true
schema:
type: number
format: double
minimum: 0
- in: query
name: longitude
required: true
schema:
type: number
format: double
minimum: 0
responses:
'200':
description: "Location is valid"
content:
application/json:
schema:
$ref: '#/components/schemas/PlaceResult'
'500':
description: "Something failed in getting the places"
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
AdditionalInformation:
type: object
properties:
key:
type: string
description: "Key of your additional information"
value:
type: string
description: "Value of your additional information"
description: "Object for storing additional informations"
Error:
description: "Error body for error responses"
type: object
required:
- reason
properties:
reason:
type: string
description: "Shows reason of error"
stacktrace:
type: string
description: "OPTIONAL: Shows complete stacktrace"
Location:
type: object
properties:
latitude:
type: number
format: double
longitude:
type: number
format: double
additionalInformation:
type: array
nullable: true
items:
$ref: '#/components/schemas/AdditionalInformation'
description: "Includes coordinates and has NO additional information. Location objects should be always accurate to the place given to it. "
MoreTripsSearch:
description: "This object represents the search body given to the trip search."
type: object
properties:
context:
type: string
description: "Context ID"
showTripsBefore:
type: boolean
description: "Shows trips before the given context, if set to false, it shows trips after the given context."
Place:
type: object
required:
- location
- stationID
- name
- placeType
properties:
location:
$ref: '#/components/schemas/Location'
stationID:
type: string
description: "The Station identifier has to be UNIQUE, even on submerged datasets this has to be the rule"
name:
type: string
description: "Exact name of the station, given by the data source"
colloquialName:
type: string
nullable: true
description: "OPTIONAL: If your station is named differently by the community, entering a colloquial name can help."
features:
type: array
items:
type: string
description: "Description of features your place has. Depending on your data source, they can be completely different."
placeType:
type: string
enum:
- station
- coordinate
- point_of_interest
- extraordinate_place
vehicleTypes:
type: array
nullable: true
items:
type: string
enum:
- airplane
- intercity_express_train
- intercity_train
- eurocity_express_train
- eurocity_train
- overnight_train
- high_speed_train
- interregional_express_train
- interregional_train
- regional_express_train
- regional_train
- suburban_train
- subway
- tram
- bus
- transrapid
- cablecar
- taxi
- autonomous_vehicle
- space_vehicle
- ridesharing
- carsharing
- ferry
- cruise_ship
- car
- motorbike
- ondemand
- bike
- walking
- misc
additionalInformation:
type: array
nullable: true
items:
$ref: '#/components/schemas/AdditionalInformation'
description: "Place is an object with coordinates, descriptions, informations and identifier. "
PlaceResult:
type: object
description: "Response of a trip search, including multiple trips sorted by importance"
required:
- places
properties:
serverRequestTimestamp:
type: number
format: double
description: "Timestamp when your server has started the request"
serverResponseTimestamp:
type: number
format: double
description: "Timestamp when your server has finished the request"
places:
type: array
items:
$ref: '#/components/schemas/Place'
Search:
description: "This object represents the search body given to the trip search."
type: object
properties:
originID:
type: string
description: "The ID of your start station/place"
destinationID:
type: string
description: "The ID of your target station/place"
time:
type: string
format: date-time
description: "Datetime where you want to search for"
isArrivalTime:
type: boolean
description: "Shows if your time is for departure or arrival of your trip."
Stopover:
description: "The place of your stopover. Includes place of arrival and times."
type: object
required:
- place
properties:
place:
$ref: '#/components/schemas/Place'
lane:
type: string
nullable: true
description: "If exist, your arrival lane can be shown here for more precise information."
departureTime:
$ref: '#/components/schemas/Time'
departureRealtime:
$ref: '#/components/schemas/Time'
arrivalTime:
$ref: '#/components/schemas/Time'
arrivalRealtime:
$ref: '#/components/schemas/Time'
additionalInformation:
type: array
nullable: true
items:
$ref: '#/components/schemas/AdditionalInformation'
SubTrip:
description: "Part of a trip"
type: object
required:
- origin
- destination
- vehicle
properties:
origin:
$ref: '#/components/schemas/Stopover'
destination:
$ref: '#/components/schemas/Stopover'
stopovers:
type: array
items:
$ref: '#/components/schemas/Stopover'
description: "OPTIONAL: Shows how many stopovers between origin and destination exist."
departureTime:
$ref: '#/components/schemas/Time'
departureRealtime:
$ref: '#/components/schemas/Time'
arrivalTime:
$ref: '#/components/schemas/Time'
arrivalRealtime:
$ref: '#/components/schemas/Time'
vehicle:
$ref: '#/components/schemas/Vehicle'
additionalInformation:
type: array
nullable: true
items:
$ref: '#/components/schemas/AdditionalInformation'
Time:
description: "Time object for precise times."
type: object
required:
- time
- unixTime
properties:
time:
type: string
format: date-time
description: "Date time in RFC 3339 standard."
unixTime:
type: number
format: double
description: "Date time as unix timestamp. (For languages which can't parse a timestamp)"
additionalInformation:
type: array
nullable: true
items:
$ref: '#/components/schemas/AdditionalInformation'
Timetable:
type: object
description: "The timetable of a place where your next departures/arrivals are listed"
required:
- place
- trips
properties:
serverRequestTimestamp:
type: number
format: double
description: "Timestamp when your server has started the request"
serverResponseTimestamp:
type: number
format: double
description: "Timestamp when your server has finished the request"
place:
$ref: '#/components/schemas/Place'
trips:
type: array
nullable: true
items:
$ref: '#/components/schemas/TimetableTrip'
description: "Shows which departures/arrivals your timetable have."
additionalInformation:
type: array
nullable: true
items:
$ref: '#/components/schemas/AdditionalInformation'
TimetableSuggestions:
type: object
description: "The timetable of a place where your next departures/arrivals are listed"
required:
- place
- trips
properties:
serverRequestTimestamp:
type: number
format: double
description: "Timestamp when your server has started the request"
serverResponseTimestamp:
type: number
format: double
description: "Timestamp when your server has finished the request"
searchPlace:
$ref: '#/components/schemas/Place'
timetables:
type: array
nullable: true
items:
$ref: '#/components/schemas/Timetable'
description: "Shows suggested timetables based on your search place"
additionalInformation:
type: array
nullable: true
items:
$ref: '#/components/schemas/AdditionalInformation'
TimetableSearch:
description: "This object represents the search body given to the timetable search."
type: object
properties:
stationID:
type: string
description: "The ID of your station/place you want the timetable from"
lookupTime:
type: string
format: date-time
description: "Datetime where you want to search for"
isArrivalTime:
type: boolean
description: "Shows if your time is for departure or arrival of your first timetable object."
TimetableTrip:
type: object
description: "A trip which includes your timetable place as stopover."
required:
- origin
- travelDestination
- time
- vehicle
properties:
origin:
$ref: '#/components/schemas/Place'
travelDestination:
$ref: '#/components/schemas/Place'
lane:
type: string
description: "Lane where you can reach your vehicle"
stopovers:
type: array
items:
$ref: '#/components/schemas/Stopover'
description: "OPTIONAL: Shows how many stopovers this current timetable trip has."
time:
$ref: '#/components/schemas/Time'
vehicle:
$ref: '#/components/schemas/Vehicle'
additionalInformation:
type: array
nullable: true
items:
$ref: '#/components/schemas/AdditionalInformation'
Trip:
description: "This object represents a whole trip with stops, times, etc."
type: object
required:
- origin
- destination
- departure
- arrival
- amountOfExchange
- subtrips
properties:
context:
type: string
description: "Context identifier of your search provider to create searches following your previous context"
origin:
$ref: '#/components/schemas/Place'
destination:
$ref: '#/components/schemas/Place'
departure:
$ref: '#/components/schemas/Time'
arrival:
$ref: '#/components/schemas/Time'
amountOfExchange:
type: integer
description: "Tells how many exchanges between stations/lanes a trip has."
subtrips:
type: array
description: "An array of found trips to your search"
items:
$ref: '#/components/schemas/SubTrip'
additionalInformation:
type: array
nullable: true
items:
$ref: '#/components/schemas/AdditionalInformation'
TripResult:
description: "This object represents the result of a trip search"
type: object
required:
- searchBody
- origin
- destination
properties:
context:
type: string
description: "Optional context of this trip result."
searchBody:
$ref: '#/components/schemas/Search'
serverRequestTimestamp:
type: number
format: double
description: "Timestamp when your server has started the request"
serverResponseTimestamp:
type: number
format: double
description: "Timestamp when your server has finished the request"
origin:
$ref: '#/components/schemas/Place'
destination:
$ref: '#/components/schemas/Place'
trips:
type: array
nullable: true
description: "An array of found trips to your search"
items:
$ref: '#/components/schemas/Trip'
additionalInformation:
type: array
nullable: true
items:
$ref: '#/components/schemas/AdditionalInformation'
Vehicle:
description: "This object shows the vehicle using for a trip"
type: object
required:
- name
- provider
- vehicleType
properties:
name:
type: string
description: "General name of your current vehicle"
lineName:
type: string
description: "OPTIONAL: Line name of your vehicle. Always nice to have this information, but still it's not required to set this property."
features:
type: array
items:
type: string
description: "Description of features your vehicle has. Depending on your data source, they can be completely different."
provider:
type: string
description: "The provider of your vehicle. It's required because everyone should know in our opinion who serves public transport to you."
vehicleType:
type: string
enum:
- airplane
- intercity_express_train
- intercity_train
- eurocity_express_train
- eurocity_train
- overnight_train
- high_speed_train
- interregional_express_train
- interregional_train
- regional_express_train
- regional_train
- suburban_train
- subway
- tram
- bus
- transrapid
- cablecar
- taxi
- autonomous_vehicle
- space_vehicle
- ridesharing
- carsharing
- ferry
- cruise_ship
- car
- motorbike
- ondemand
- bike
- walking
- misc
additionalInformation:
type: array
nullable: true
items:
$ref: '#/components/schemas/AdditionalInformation'