-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathopenapi.yaml
More file actions
629 lines (603 loc) · 17.7 KB
/
openapi.yaml
File metadata and controls
629 lines (603 loc) · 17.7 KB
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
openapi: 3.0.0
info:
title: Lviv Public Transport API
description: >
Real-time and static data for public transport in Lviv, Ukraine.
Provides stop arrivals, vehicle positions, route schedules, and nearby
transit lookups backed by GTFS-RT feeds from Microgiz.
version: 1.1.0
contact:
url: https://lad.lviv.ua
servers:
- url: https://api.lad.lviv.ua
description: Production server
paths:
/stops/{code}/timetable:
get:
operationId: getArrivalsByStopCode
summary: Real-time arrivals at a stop
description: >
Returns upcoming vehicle arrivals at the stop identified by its
numeric code. Data is sourced from live GTFS-RT feeds and refreshes
every 5–10 seconds.
parameters:
- $ref: '#/components/parameters/stopCode'
responses:
'200':
description: Array of upcoming arrivals, sorted by arrival time.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Arrival'
'404':
description: Stop not found.
/stops/{code}/static:
get:
operationId: getStopStaticData
summary: Static stop info (no real-time data)
description: >
Returns name, coordinates, and connecting routes for a stop.
Cached for up to 30 days — use this when real-time arrivals are
not needed.
parameters:
- $ref: '#/components/parameters/stopCode'
responses:
'200':
description: Static stop metadata.
content:
application/json:
schema:
$ref: '#/components/schemas/StopStatic'
'404':
description: Stop not found.
/stops/{code}:
get:
operationId: getStop
summary: Stop info with optional real-time timetable
description: >
Returns stop metadata and, by default, live arrivals. Pass
`skipTimetableData=true` to get only static data (faster, heavily
cached).
parameters:
- $ref: '#/components/parameters/stopCode'
- name: skipTimetableData
in: query
description: Set to `true` to skip real-time arrivals and return only static stop data.
schema:
type: boolean
default: false
responses:
'200':
description: Stop data with optional timetable.
content:
application/json:
schema:
$ref: '#/components/schemas/StopWithTimetable'
'404':
description: Stop not found.
/closest:
get:
operationId: getClosestStops
summary: Stops near a coordinate
description: >
Returns all stops within `radius` metres of the given coordinates,
sorted by distance. Use this to find stop codes when you only know
an address or GPS position.
parameters:
- name: latitude
in: query
required: true
description: WGS-84 latitude (−90 to 90).
schema:
type: number
format: double
- name: longitude
in: query
required: true
description: WGS-84 longitude (−180 to 180).
schema:
type: number
format: double
- name: radius
in: query
description: Search radius in metres. Clamped to 50–3000. Default 1000.
schema:
type: integer
default: 1000
minimum: 50
maximum: 3000
responses:
'200':
description: Stops sorted by distance from the given point.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/StopNearby'
'400':
description: Invalid coordinates.
/routes/static/{name}:
get:
operationId: getRouteStaticInfo
summary: Static route schedule and shape
description: >
Returns the route's stop lists for both directions, their coordinates,
connecting transfers, first-stop departure times, and the polyline
shapes. Cached for up to 30 days.
parameters:
- $ref: '#/components/parameters/routeName'
responses:
'200':
description: Full static route data.
content:
application/json:
schema:
$ref: '#/components/schemas/RouteStatic'
'404':
description: Route not found.
/routes/dynamic/{name}:
get:
operationId: getRouteVehiclePositions
summary: Live vehicle positions on a route
description: >
Returns the current GPS positions of all active vehicles on the
specified route, with direction and low-floor flag.
parameters:
- $ref: '#/components/parameters/routeName'
responses:
'200':
description: Array of vehicle positions on this route.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/RouteVehicle'
'404':
description: Route not found.
/vehicle/{vehicleId}:
get:
operationId: getVehicleInfo
summary: Single vehicle position and upcoming stop arrivals
description: >
Returns the current GPS position, route, direction, and the full
remaining stop sequence with predicted arrival/departure times for
a specific vehicle.
parameters:
- name: vehicleId
in: path
required: true
description: Vehicle identifier (from timetable or route dynamic data).
schema:
type: string
responses:
'200':
description: Vehicle position and upcoming arrivals.
content:
application/json:
schema:
$ref: '#/components/schemas/VehicleInfo'
'404':
description: Vehicle not currently active.
/vehicle-by-plate/{plate}:
get:
operationId: getVehicleByPlate
summary: Look up a vehicle ID by license plate
description: >
Returns the vehicle ID for the given license plate. Matching is
case-insensitive and ignores spaces and dashes, so `BC-1234-AA`,
`bc 1234 aa`, and `bc1234aa` are all equivalent. Use the returned
`vehicleId` with `GET /vehicle/{vehicleId}` to fetch full details.
parameters:
- name: plate
in: path
required: true
description: >
Vehicle license plate in any format — dashes and spaces are ignored
(e.g. `BC-1234-AA`, `bc 1234 aa`, `BC1234AA`).
schema:
type: string
example: BC-1234-AA
responses:
'200':
description: Vehicle found.
content:
application/json:
schema:
type: object
properties:
vehicleId:
type: string
description: Vehicle identifier, usable with /vehicle/{vehicleId}.
example: "tram_42"
required:
- vehicleId
'404':
description: No active vehicle with this license plate.
/transport:
get:
operationId: getNearbyTransport
summary: Vehicles currently within 1 km of a coordinate
description: >
Returns all active vehicles within 1 kilometre of the given
coordinate, regardless of route. Useful for a "what's passing near
me right now" query.
parameters:
- name: latitude
in: query
required: true
description: WGS-84 latitude (−90 to 90).
schema:
type: number
format: double
- name: longitude
in: query
required: true
description: WGS-84 longitude (−180 to 180).
schema:
type: number
format: double
responses:
'200':
description: Nearby active vehicles.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/NearbyVehicle'
'400':
description: Invalid coordinates.
/stops.json:
get:
operationId: getAllStops
summary: Full stop list
description: Returns every stop in the network with its code, name, location, and served routes.
responses:
'200':
description: Array of all stops.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/StopSummary'
/routes.json:
get:
operationId: getAllRoutes
summary: Full route list
description: Returns every route in the network with all internal fields.
responses:
'200':
description: Array of all routes.
content:
application/json:
schema:
type: array
items:
type: object
description: Raw route record from the internal database.
components:
parameters:
stopCode:
name: code
in: path
required: true
description: Numeric stop code printed on physical stop signage (e.g. 707).
schema:
type: integer
routeName:
name: name
in: path
required: true
description: >
Route short name as shown on vehicles (e.g. `5`, `32А`, `T30`), or
the numeric external route ID.
schema:
type: string
schemas:
Transfer:
type: object
description: A connecting route available at a stop.
properties:
route:
type: string
description: Route short name (e.g. "32А").
example: "32А"
vehicle_type:
type: string
enum: [bus, tram, trolleybus]
color:
type: string
description: Hex colour for map rendering (e.g. "#E31E30").
example: "#E31E30"
shape_id:
type: string
Arrival:
type: object
description: A single upcoming vehicle arrival at a stop.
properties:
route_id:
type: string
description: Internal route identifier.
route:
type: string
description: Route short name shown to passengers.
example: "5"
vehicle_type:
type: string
enum: [bus, tram, trolleybus]
color:
type: string
description: Hex colour for map rendering.
example: "#E31E30"
lowfloor:
type: boolean
description: True if the vehicle is low-floor (accessible).
end_stop:
type: string
description: Headsign / final stop name.
arrival_time:
type: string
description: Predicted arrival in UTC string format.
example: "Fri, 02 May 2025 14:35:00 GMT"
time_left:
type: string
description: Human-readable wait time in Ukrainian (e.g. "3 хв").
example: "3 хв"
vehicle_id:
type: string
description: Vehicle identifier (usable with /vehicle/{vehicleId}).
location:
type: array
description: "[latitude, longitude] of the vehicle."
items:
type: number
minItems: 2
maxItems: 2
bearing:
type: number
description: Vehicle heading in degrees (0 = north).
direction:
type: integer
description: Route direction index (0 or 1).
enum: [0, 1]
StopStatic:
type: object
properties:
code:
type: integer
description: Numeric stop code.
example: 707
name:
type: string
description: Ukrainian stop name.
example: "Площа Ринок"
eng_name:
type: string
description: English transliteration of the stop name.
example: "Rynok Square"
latitude:
type: number
format: double
longitude:
type: number
format: double
transfers:
type: array
items:
$ref: '#/components/schemas/Transfer'
wikipedia:
type: string
description: Wikipedia URL for notable stops (optional).
StopWithTimetable:
allOf:
- $ref: '#/components/schemas/StopStatic'
- type: object
properties:
timetable:
type: array
items:
$ref: '#/components/schemas/Arrival'
StopNearby:
type: object
properties:
code:
type: integer
example: 707
name:
type: string
example: "Площа Ринок"
latitude:
type: number
format: double
longitude:
type: number
format: double
distance_meters:
type: integer
description: Distance from the queried point in metres.
example: 150
StopSummary:
type: object
properties:
code:
type: integer
example: 707
name:
type: string
eng_name:
type: string
location:
type: array
description: "[latitude, longitude]"
items:
type: number
minItems: 2
maxItems: 2
routes:
type: array
description: Short names of routes serving this stop.
items:
type: string
sign:
type: string
description: URL to the SVG timetable sign for this stop.
sign_pdf:
type: string
description: URL to the PDF timetable sign for this stop.
RouteStop:
type: object
properties:
code:
type: integer
name:
type: string
loc:
type: array
description: "[latitude, longitude]"
items:
type: number
minItems: 2
maxItems: 2
transfers:
type: array
items:
$ref: '#/components/schemas/Transfer'
departures:
type: array
description: Scheduled departure times from the first stop (HH:MM strings, only populated for direction 0 first stop).
items:
type: string
RouteStatic:
type: object
properties:
id:
type: string
description: Internal route ID.
route_short_name:
type: string
example: "32А"
route_long_name:
type: string
example: "вул. Зелена — вул. Городоцька"
type:
type: string
enum: [bus, tram, trolleybus]
color:
type: string
example: "#E31E30"
stops:
type: array
description: Two-element array — stops for direction 0 and direction 1.
items:
type: array
items:
$ref: '#/components/schemas/RouteStop'
minItems: 2
maxItems: 2
shapes:
type: array
description: Two-element array of polylines — one per direction. Each polyline is an array of [lat, lon] pairs.
items:
type: array
items:
type: array
items:
type: number
minItems: 2
maxItems: 2
minItems: 2
maxItems: 2
RouteVehicle:
type: object
description: A vehicle actively running on a route.
properties:
id:
type: string
description: Vehicle identifier.
direction:
type: integer
enum: [0, 1]
location:
type: array
description: "[latitude, longitude]"
items:
type: number
minItems: 2
maxItems: 2
bearing:
type: number
lowfloor:
type: boolean
VehicleArrival:
type: object
properties:
code:
type: integer
description: Stop code.
arrival:
type: string
nullable: true
description: Predicted arrival time in UTC string format.
departure:
type: string
nullable: true
description: Predicted departure time in UTC string format.
transfers:
type: array
items:
$ref: '#/components/schemas/Transfer'
VehicleInfo:
type: object
properties:
location:
type: array
description: "[latitude, longitude]"
items:
type: number
minItems: 2
maxItems: 2
routeId:
type: string
bearing:
type: number
direction:
type: integer
enum: [0, 1]
licensePlate:
type: string
nullable: true
arrivals:
type: array
description: Remaining stops with predicted times.
items:
$ref: '#/components/schemas/VehicleArrival'
NearbyVehicle:
type: object
properties:
id:
type: string
route:
type: string
example: "5"
vehicle_type:
type: string
enum: [bus, tram, trolleybus]
color:
type: string
example: "#E31E30"
location:
type: array
description: "[latitude, longitude]"
items:
type: number
minItems: 2
maxItems: 2
bearing:
type: number
lowfloor:
type: boolean