-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi-dependencies.ts
More file actions
219 lines (178 loc) · 6.78 KB
/
openapi-dependencies.ts
File metadata and controls
219 lines (178 loc) · 6.78 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
// TODO - split request / response
// TODO - this should be generated
// - in request (builder) XML
const MapNS_Tags: Record<string, string> = {
'OJPRequest.ServiceRequest': 'siri',
'ServiceRequest.ServiceRequestContext': 'siri',
'ServiceRequestContext.Language': 'siri',
'ServiceRequest.RequestTimestamp': 'siri',
'ServiceRequest.RequestorRef': 'siri',
'OJPResponse.ServiceDelivery': 'siri',
'ServiceDelivery.ResponseTimestamp': 'siri',
'ServiceDelivery.ProducerRef': 'siri',
// TRR
'OJPTripRefineRequest.RequestTimestamp': 'siri',
// FareRequest
'OJPFareRequest.RequestTimestamp': 'siri',
// TripInfoRequest
'OJPTripInfoRequest.RequestTimestamp': 'siri',
// TripRequest
'OJPTripRequest.RequestTimestamp': 'siri',
// TripResponse
'OJPTripDelivery.ResponseTimestamp': 'siri',
'OJPTripDelivery.RequestMessageRef': 'siri',
'OJPTripDelivery.DefaultLanguage': 'siri',
'LegBoard.StopPointRef': 'siri',
'LegIntermediate.StopPointRef': 'siri',
'LegIntermediates.StopPointRef': 'siri', // OJP v1
'LegAlight.StopPointRef': 'siri',
'Mode.AirSubmode': 'siri',
'Mode.BusSubmode': 'siri',
'Mode.CoachSubmode': 'siri',
'Mode.FunicularSubmode': 'siri',
'Mode.MetroSubmode': 'siri',
'Mode.TramSubmode': 'siri',
'Mode.TelecabinSubmode': 'siri',
'Mode.RailSubmode': 'siri',
'Mode.WaterSubmode': 'siri',
'ModeAndModeOfOperationFilter.AirSubmode': 'siri',
'ModeAndModeOfOperationFilter.BusSubmode': 'siri',
'ModeAndModeOfOperationFilter.CoachSubmode': 'siri',
'ModeAndModeOfOperationFilter.FunicularSubmode': 'siri',
'ModeAndModeOfOperationFilter.MetroSubmode': 'siri',
'ModeAndModeOfOperationFilter.TramSubmode': 'siri',
'ModeAndModeOfOperationFilter.TelecabinSubmode': 'siri',
'ModeAndModeOfOperationFilter.RailSubmode': 'siri',
'ModeAndModeOfOperationFilter.WaterSubmode': 'siri',
'Service.LineRef': 'siri',
'Service.OperatorRef': 'siri',
'Service.DirectionRef': 'siri',
'TrackSectionStart.StopPointRef': 'siri',
'TrackSectionEnd.StopPointRef': 'siri',
'Position.Longitude': 'siri',
'Position.Latitude': 'siri',
'LegStart.StopPointRef': 'siri',
'LegEnd.StopPointRef': 'siri',
// ExpectedDepartureOccupancy
'LegBoard.ExpectedDepartureOccupancy': 'siri',
'LegAlight.ExpectedDepartureOccupancy': 'siri',
'LegIntermediate.ExpectedDepartureOccupancy': 'siri',
'ExpectedDepartureOccupancy.FareClass': 'siri',
'ExpectedDepartureOccupancy.OccupancyLevel': 'siri',
// LIR Request
'OJPLocationInformationRequest.RequestTimestamp': 'siri',
'UpperLeft.Longitude': 'siri',
'UpperLeft.Latitude': 'siri',
'LowerRight.Longitude': 'siri',
'LowerRight.Latitude': 'siri',
// TR Request
'GeoPosition.Longitude': 'siri',
'GeoPosition.Latitude': 'siri',
'Line.LineRef': 'siri',
// SER Request
'OJPStopEventRequest.RequestTimestamp': 'siri',
'PlaceRef.StopPointRef': 'siri',
};
// OJP Legacy(v1): keep same k/v as in MapNS_Tags and override only some
const MapLegacyOverrideNS_Tags: Record<string, string> = {
'Service.OperatorRef': 'ojp',
}
// TODO - this should be generated
// - this is used by the parser.isArrayHandler - to always return arrays even when there is only one result
// - in response (parser) XML
const MapArrayTags: Record<string, boolean> = {
// Shared
'places.place': true,
'linkProjection.position': true,
// PSituation Refs
'situationFullRefs.situationFullRef': true,
'situations.ptSituation': true,
// PtSituation OJP v2
'ptSituation.validityPeriod': true,
'publishingActions.publishingAction': true,
'publishingAction.passengerInformationAction': true,
'passengerInformationAction.textualContent': true,
'textualContent.descriptionContent': true,
'textualContent.consequenceContent': true,
'textualContent.recommendationContent': true,
'textualContent.remarkContent': true,
'textualContent.infoLink': true,
// technically these are also arrays - but the OJP repsonse never returned it as such
// 'descriptionContent.descriptionText': true,
// 'consequenceContent.consequenceText': true,
// 'recommendationContent.recommendationText': true,
// 'remarkContent.remark': true,
'itModeAndModeOfOperation.personalModeOfOperation': true,
// Service
'service.attribute': true,
// TR Request
'origin.individualTransportOption': true,
'destination.individualTransportOption': true,
// TR Response
'OJPTripDelivery.tripResult': true,
'trip.leg': true,
'timedLeg.legIntermediate': true,
'legTrack.trackSection': true,
'pathGuidance.pathGuidanceSection': true,
// TR Response, ExpectedDepartureOccupancy
'legBoard.expectedDepartureOccupancy': true,
'legIntermediate.expectedDepartureOccupancy': true,
'legAlight.expectedDepartureOccupancy': true,
// LIR Response
'OJPLocationInformationDelivery.placeResult': true,
'place.mode': true,
'place.attribute': true,
// LIR Response POI
'pointOfInterest.pointOfInterestCategory': true,
'pointOfInterestCategory.osmTag': true,
'pointOfInterestCategory.pointOfInterestClassification': true,
'pOIAdditionalInformation.pOIAdditionalInformation': true,
// Fare Response
'OJPFareDelivery.fareResult': true,
'fareResult.tripFareResult': true, // TODO - this is not in the current schema (v2)
'tripFareResult.fareProduct': true,
// StopEvent Response
'OJPStopEventDelivery.stopEventResult': true,
'stopEvent.previousCall': true,
'stopEvent.onwardCall': true,
// TripInfoResult
'OJPTripInfoDelivery.tripInfoResult': true,
'tripInfoResult.previousCall': true,
'tripInfoResult.onwardCall': true,
'journeyTrack.trackSection': true,
// TripRefineResult
'OJPTripRefineDelivery.tripResult': true,
};
// OJP v1.0
// - this is used by the parser.isArrayHandler - to always return arrays even when there is only one result
// - in response (parser) XML
const MapLegacyArrayTags: Record<string, boolean> = {
'places.location': true,
'trip.tripLeg': true,
// PtSituation OJP v1
'callAtStop.situationFullRef': true,
'ptSituation.description': true,
'ptSituation.detail': true,
'stopPoints.affectedStopPoint': true,
'vehicleJourneys.affectedVehicleJourney': true,
// in OJPv1 there is no <SituationFullRefs> wrapper, the <SituationFullRef> are directly under <Service>
'service.situationFullRef': true,
'timedLeg.legIntermediates': true,
'OJPLocationInformationDelivery.location': true,
'location.mode': true,
'location.attribute': true,
};
// TODO - this should be generated
// - in response (parser) XML
const MapStringValues: Record<string, boolean> = {
'stopPlace.stopPlaceRef': true,
'publishedServiceName.text': true,
'service.operatorRef': true,
};
export const OpenAPI_Dependencies = {
MapNS_Tags: MapNS_Tags,
MapLegacyOverrideNS_Tags: MapLegacyOverrideNS_Tags,
MapArrayTags: MapArrayTags,
MapLegacyArrayTags: MapLegacyArrayTags,
MapStringValues: MapStringValues,
} as const;