Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream merge 2025-01-03 #242

Merged
merged 139 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
4b052d5
Draft upcoming cancelled trips query
vesameskanen Oct 2, 2023
2e6529e
Remove duplicate imports
vesameskanen Oct 3, 2023
627d251
Node resolver for DatedTrip
vesameskanen Oct 3, 2023
6c26434
Hook in DatedTrip data fetcher
vesameskanen Oct 4, 2023
fb71d74
Feed filtering parameter for cancelled trips query
vesameskanen Oct 4, 2023
184e7e2
More efficient iteration over all trips
vesameskanen Oct 4, 2023
2787b7e
Sort cancelled trips by ascending time
vesameskanen Oct 4, 2023
58f0387
Move filtering by feed into transit service
vesameskanen Oct 4, 2023
3388c15
Merge remote-tracking branch 'otp/dev-2.x' into gtfsgraphql-cancelled…
vesameskanen Oct 17, 2023
45aacde
Merge remote-tracking branch 'otp/dev-2.x' into gtfsgraphql-cancelled…
vesameskanen Dec 28, 2023
d65d5dd
Update typescript-eslint monorepo to v8
renovate[bot] Aug 1, 2024
46a40ef
Upgrade to eslint v9
testower Aug 1, 2024
f162ce8
Migrate to new config
testower Aug 1, 2024
a1fe6e3
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome Aug 6, 2024
20df02b
Use LocalDate for date and include trip's fields instead of trip
optionsome Aug 7, 2024
2a9df2a
Improve documentation and mark cancelledTripTimes as deprecated
optionsome Aug 8, 2024
b142bdf
Add start and end to schema
optionsome Aug 8, 2024
8e12d3a
Create DatedStopTime type and use it in DatedTrip
optionsome Aug 9, 2024
53ff5d5
cancelled -> canceled
optionsome Aug 9, 2024
0469361
Add graphql test
optionsome Aug 9, 2024
c0648b7
Rename method
optionsome Aug 9, 2024
6437bd7
Add small tests
optionsome Aug 9, 2024
6e143d9
Realtime -> RealTime
optionsome Aug 9, 2024
1de24b2
Add more tests
optionsome Aug 9, 2024
7251391
Refactor canceled trips fetching to be more efficient
optionsome Sep 9, 2024
bedee96
Update and fix tests
optionsome Sep 9, 2024
c0768e0
Create an union for dated stoptimes
optionsome Sep 9, 2024
66100b9
Use TripOnServiceDate and redesign schema
optionsome Oct 18, 2024
284c483
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome Oct 18, 2024
079485e
Remove stuff from new stoptime type
optionsome Oct 25, 2024
c15a29e
Mark stopTimes as non-null
optionsome Oct 25, 2024
65927c6
Do less inside timetable snapshot provider initialization
optionsome Oct 25, 2024
9c124df
Minor fixes
optionsome Oct 25, 2024
9e5eb14
Rename FixedDatedStopTime -> FixedStopTimeOnServiceDate
optionsome Oct 25, 2024
c8924fc
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome Oct 25, 2024
7f1948e
Run codegen
optionsome Oct 25, 2024
7ed48c3
Improve schema doc and mark some fields as non-null
optionsome Oct 31, 2024
2797fa5
Slightly refactor methods to fetch cancelled trips
optionsome Nov 1, 2024
a2b30f8
Improve schema doc
optionsome Nov 1, 2024
6eaef7a
Rename date -> serviceDate
optionsome Nov 1, 2024
396c43c
Rename ArrivalDepartureTime -> FixedArrivalDepartureTime and LegTime …
optionsome Nov 1, 2024
be25fe3
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome Nov 2, 2024
672a968
Make TripOnServiceDate an interface and rename some types
optionsome Nov 13, 2024
ec59d99
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome Nov 13, 2024
8885c19
Rename RegularArrivalDepartureTime -> LegCallTime
optionsome Nov 17, 2024
c7d6d43
Refactor LegCallTime
optionsome Nov 17, 2024
178c150
Rename StopTime -> StopCall etc. and create own model for its times
optionsome Nov 18, 2024
349efb6
Create implementations for call times
optionsome Nov 18, 2024
405f580
Remove support for feeds argument
optionsome Nov 19, 2024
ac21d8a
Improve doc
optionsome Nov 21, 2024
ca53100
Redesign schema
optionsome Nov 22, 2024
45a01af
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome Nov 22, 2024
de5758b
Add module test for listing canceled trips
leonardehrenfried Nov 25, 2024
e6c0036
Remove duplication
leonardehrenfried Nov 25, 2024
bee85de
Renaming or ordering
optionsome Nov 25, 2024
dba65b0
Update application/src/main/resources/org/opentripplanner/apis/gtfs/s…
optionsome Nov 26, 2024
33189c2
Rename 'transferByStopIndex' variable to 'transfersByStopIndex'.
VillePihlava Nov 26, 2024
aa4927e
Add changes for CAR transfers.
VillePihlava Nov 29, 2024
4c882f4
Add EnumSet of StreetModes to PathTransfers and implement mode-specif…
VillePihlava Nov 29, 2024
44e4d31
Add test for mode-specific transfers.
VillePihlava Nov 29, 2024
8448e6e
Remove unused imports and small changes.
VillePihlava Nov 29, 2024
b3bad26
Implement new schema design
optionsome Dec 2, 2024
ff426dc
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome Dec 2, 2024
6a485a3
Minor schema doc fixes
optionsome Dec 2, 2024
5217ce5
Formatting
optionsome Dec 2, 2024
3c46be3
Add logging for mode-specific transfers.
VillePihlava Dec 3, 2024
a682d98
fix: Add default penalty to all car api modes.
t2gran Dec 3, 2024
c4951ff
Merge branch 'dev-2.x' of github.com:opentripplanner/OpenTripPlanner …
VillePihlava Dec 4, 2024
244c537
Fix flex routing transfer calculations and only calculate flex transf…
VillePihlava Dec 4, 2024
15656d5
Add fallback names for corridors
leonardehrenfried Dec 4, 2024
d7fd1d8
Add translations for all languages
leonardehrenfried Dec 4, 2024
97a47ef
update color brightness calculation
miklcct Dec 5, 2024
7ce751b
update the text color for the frontend as well
miklcct Dec 5, 2024
e1bb7d6
Make flex linking work together with boarding locations
leonardehrenfried Dec 6, 2024
22a414c
Add javadoc
leonardehrenfried Dec 6, 2024
47d4441
Add warnings
leonardehrenfried Dec 6, 2024
ee5b842
Improve comment
leonardehrenfried Dec 9, 2024
012f149
Add changes based on review comments.
VillePihlava Dec 9, 2024
984d34e
Change how EnumSet is copied and make EnumSet immutable in Transfer.
VillePihlava Dec 9, 2024
ebbba52
Apply review feedback
leonardehrenfried Dec 9, 2024
b667e96
remove invalid comment
miklcct Dec 10, 2024
15c7da2
refactor: Delete old comments/config in shaded-jar pom.xml
t2gran Dec 10, 2024
c90aea1
feature: Add 'otp-shaded.jar' as an Maven published artifact.
t2gran Dec 10, 2024
f85cf52
doc: Fix references to the otp-shaded jar in doc.
t2gran Dec 10, 2024
3ae6eed
Change logging in transfer calculations.
VillePihlava Dec 11, 2024
4a01328
Refactor to use method.
VillePihlava Dec 12, 2024
95e9ca7
Rename getTransfersByMode to findTransfers.
VillePihlava Dec 12, 2024
d12373f
use MethodSource instead of FieldSource
miklcct Dec 12, 2024
8c965c9
Merge pull request #6308 from Jnction/gtfs-text-luminance
optionsome Dec 12, 2024
ae85810
Upgrade debug client to version 2024/12/2024-12-12T20:08
Dec 12, 2024
0caa51a
Add changelog entry for #6308 [ci skip]
Dec 12, 2024
fbd1ff1
Rename 'bogusName' to 'nameIsDerived'
leonardehrenfried Dec 12, 2024
4c6db7f
Rename missing method
leonardehrenfried Dec 13, 2024
d936e6b
Merge pull request #6331 from entur/add_shaded_jar_artifact
t2gran Dec 13, 2024
f384f07
Add changelog entry for #6331 [ci skip]
Dec 13, 2024
2592135
doc: Improve changelog name for PR: #6331 Rename `otp-shaded-jar` art…
t2gran Dec 13, 2024
f9b33c5
Also exclude container build from shaded jar
leonardehrenfried Dec 13, 2024
df64c5a
Changes based on review comments and small optimization.
VillePihlava Dec 13, 2024
9b44df0
Add comments.
VillePihlava Dec 13, 2024
c75b0a2
Fix spelling.
VillePihlava Dec 13, 2024
6dc9a4e
review: Apply fixes from review
t2gran Dec 13, 2024
d881c9d
fix(deps): update dependency graphql to v16.10.0
renovate[bot] Dec 15, 2024
18215a9
Add comment.
VillePihlava Dec 15, 2024
31c40f7
Merge pull request #5393 from HSLdevcom/gtfsgraphql-cancelled-trips
tkalvas Dec 16, 2024
5a3ef6a
Add changelog entry for #5393 [ci skip]
Dec 16, 2024
d305306
Show generalized cost in debug UI
leonardehrenfried Dec 16, 2024
8d321e7
Add tooltip
leonardehrenfried Dec 16, 2024
19c2804
Merge pull request #6293 from HSLdevcom/split-transfers-by-mode-patht…
optionsome Dec 16, 2024
4375d3c
Add changelog entry for #6293 [ci skip]
Dec 16, 2024
74f2f22
Bump serialization version id for #6293
Dec 16, 2024
3a37262
Merge pull request #6334 from opentripplanner/renovate/graphql-16.x
leonardehrenfried Dec 16, 2024
65e976a
fix(deps): update test dependencies (#6338)
renovate[bot] Dec 17, 2024
e9f5941
Merge pull request #6333 from leonardehrenfried/bogus-name
leonardehrenfried Dec 17, 2024
cbdb640
Merge pull request #6302 from entur/fix_time_penalty_on_car_mode_defa…
t2gran Dec 17, 2024
e130997
Add changelog entry for #6302 [ci skip]
Dec 17, 2024
edcba5a
Use cent sign for generalized cost
leonardehrenfried Dec 17, 2024
b04dc99
Merge pull request #6336 from leonardehrenfried/debug-ui-cost
leonardehrenfried Dec 17, 2024
5f9b448
Upgrade debug client to version 2024/12/2024-12-17T11:50
Dec 17, 2024
313ac9c
fix(deps): update debug ui dependencies (non-major)
renovate[bot] Dec 17, 2024
e1e5fed
Fix formatting
leonardehrenfried Dec 17, 2024
554e3bd
Merge pull request #6341 from opentripplanner/renovate/debug-ui-depen…
leonardehrenfried Dec 18, 2024
2d012a3
Upgrade debug client to version 2024/12/2024-12-18T09:00
Dec 18, 2024
2eedb12
fix test failure when building OTP in a path with special characters.
miklcct Dec 18, 2024
b30e045
Merge pull request #6311 from ibi-group/flex-linking
leonardehrenfried Dec 19, 2024
ed2d7f5
Add changelog entry for #6311 [ci skip]
Dec 19, 2024
b9f4135
remove unused import
miklcct Dec 19, 2024
4198bb6
Merge pull request #6344 from Jnction/fix/build_path
tkalvas Dec 19, 2024
e890466
Merge pull request #6303 from ibi-group/corridor-name
leonardehrenfried Dec 23, 2024
6e8ccff
Add changelog entry for #6303 [ci skip]
Dec 23, 2024
ac8058b
chore(deps): update dependency mkdocs-material to v9.5.49 (#6352)
renovate[bot] Jan 1, 2025
9d97679
Merge branch 'dev-2.x' into eslint-9
testower Jan 2, 2025
2d4ff0c
Updates for eslint v9
testower Jan 2, 2025
57898e6
Update package-lock
testower Jan 2, 2025
c5ba6e8
Merge pull request #6356 from entur/eslint-9
leonardehrenfried Jan 2, 2025
e1b3064
Upgrade debug client to version 2025/01/2025-01-02T15:56
Jan 2, 2025
2f2ab3e
Merge remote-tracking branch 'upstream/dev-2.x' into upstream-merge-2…
leonardehrenfried Jan 3, 2025
a27b052
Change location of shaded jar
leonardehrenfried Jan 3, 2025
07f4824
Change jar location
leonardehrenfried Jan 3, 2025
256127e
Disable Denver smoke tests
leonardehrenfried Jan 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/performance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
- name: Build graph
if: matrix.profile == 'core' || github.ref == 'refs/heads/dev-2.x'
run: |
cp shaded-jar/target/otp-*-SNAPSHOT-shaded.jar otp.jar
cp otp-shaded/target/otp-shaded-*-SNAPSHOT.jar otp.jar
java -Xmx32G -jar otp.jar --build --save test/performance/${{ matrix.location }}/

- name: Run speed test
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
sleep: 15
- name: houston
sleep: 30
- name: denver
sleep: 15
#- name: denver
# sleep: 15
- name: septa
sleep: 15
- name: portland
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ We run a speed test (included in the code) to measure the performance for every

## Repository layout

The main Java server code is in `application/src/main/`. OTP also includes a Javascript client based on the
MapLibre mapping library in `client/src/`. This client is now used for testing, with most major
deployments building custom clients from reusable components. The Maven build produces a unified ("shaded")
JAR file at `shaded-jar/target/otp-VERSION.jar` containing all necessary code and dependencies to run OpenTripPlanner.
The main Java server code is in `application/src/main/`. OTP also includes a Javascript client
based on the MapLibre mapping library in `client/src/`. This client is now used for testing, with
most major deployments building custom clients from reusable components. The Maven build produces a
unified ("shaded") JAR file at `otp-shaded/target/otp-shaded-VERSION.jar` containing all necessary
code and dependencies to run OpenTripPlanner.

Additional information and instructions are available in
the [main documentation](http://docs.opentripplanner.org/en/dev-2.x/), including a
Expand All @@ -59,7 +60,11 @@ the world.

## Getting in touch

The fastest way to get help is to use our [Gitter chat room](https://gitter.im/opentripplanner/OpenTripPlanner) where most of the core developers are. Bug reports may be filed via the Github [issue tracker](https://github.com/openplans/OpenTripPlanner/issues). The OpenTripPlanner [mailing list](http://groups.google.com/group/opentripplanner-users) is used almost exclusively for project announcements. The mailing list and issue tracker are not intended for support questions or discussions. Please use the chat for this purpose. Other details of [project governance](http://docs.opentripplanner.org/en/dev-2.x/Governance/) can be found in the main documentation.
The fastest way to get help is to use our [Gitter chat room](https://gitter.im/opentripplanner/OpenTripPlanner) where most of the core developers
are. Bug reports may be filed via the Github [issue tracker](https://github.com/openplans/OpenTripPlanner/issues). The OpenTripPlanner [mailing list](http://groups.google.com/group/opentripplanner-users)
is used almost exclusively for project announcements. The mailing list and issue tracker are not
intended for support questions or discussions. Please use the chat for this purpose. Other details
of [project governance](http://docs.opentripplanner.org/en/dev-2.x/Governance/) can be found in the main documentation.

## OTP Ecosystem

Expand Down
4 changes: 2 additions & 2 deletions application/src/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<link rel="icon" type="image/svg+xml" href="/img/otp-logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OTP Debug</title>
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/12/2024-12-09T10:11/assets/index-Cy40AOLN.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/12/2024-12-09T10:11/assets/index-DygGy0HD.css">
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2025/01/2025-01-02T15:56/assets/index-DODY0n0n.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2025/01/2025-01-02T15:56/assets/index-BDL0-veX.css">
</head>
<body>
<div id="root"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.locationtech.jts.geom.LineString;
import org.opentripplanner.model.fare.FareProductUse;
import org.opentripplanner.model.plan.Leg;
import org.opentripplanner.model.plan.LegTime;
import org.opentripplanner.model.plan.LegCallTime;
import org.opentripplanner.model.plan.Place;
import org.opentripplanner.model.plan.StopArrival;
import org.opentripplanner.model.plan.TransitLeg;
Expand Down Expand Up @@ -55,12 +55,12 @@ public Trip getTrip() {
}

@Override
public LegTime start() {
public LegCallTime start() {
return first.start();
}

@Override
public LegTime end() {
public LegCallTime end() {
return second.end();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.Map;
import org.opentripplanner.ext.flex.trip.FlexTrip;
import org.opentripplanner.model.PathTransfer;
import org.opentripplanner.routing.api.request.StreetMode;
import org.opentripplanner.transit.model.framework.FeedScopedId;
import org.opentripplanner.transit.model.network.Route;
import org.opentripplanner.transit.model.site.GroupStop;
Expand All @@ -18,15 +19,19 @@ public class FlexIndex {

private final Multimap<StopLocation, PathTransfer> transfersToStop = ArrayListMultimap.create();

private final Multimap<StopLocation, PathTransfer> transfersFromStop = ArrayListMultimap.create();

private final Multimap<StopLocation, FlexTrip<?, ?>> flexTripsByStop = HashMultimap.create();

private final Map<FeedScopedId, Route> routeById = new HashMap<>();

private final Map<FeedScopedId, FlexTrip<?, ?>> tripById = new HashMap<>();

public FlexIndex(TimetableRepository timetableRepository) {
for (PathTransfer transfer : timetableRepository.getAllPathTransfers()) {
// Flex transfers should only use WALK mode transfers.
for (PathTransfer transfer : timetableRepository.findTransfers(StreetMode.WALK)) {
transfersToStop.put(transfer.to, transfer);
transfersFromStop.put(transfer.from, transfer);
}
for (FlexTrip<?, ?> flexTrip : timetableRepository.getAllFlexTrips()) {
routeById.put(flexTrip.getTrip().getRoute().getId(), flexTrip.getTrip().getRoute());
Expand All @@ -47,6 +52,10 @@ public Collection<PathTransfer> getTransfersToStop(StopLocation stopLocation) {
return transfersToStop.get(stopLocation);
}

public Collection<PathTransfer> getTransfersFromStop(StopLocation stopLocation) {
return transfersFromStop.get(stopLocation);
}

public Collection<FlexTrip<?, ?>> getFlexTripsByStop(StopLocation stopLocation) {
return flexTripsByStop.get(stopLocation);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public TransitStopVertex getStopVertexForStopId(FeedScopedId stopId) {

@Override
public Collection<PathTransfer> getTransfersFromStop(StopLocation stop) {
return transitService.findPathTransfers(stop);
return transitService.getFlexIndex().getTransfersFromStop(stop);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.opentripplanner.model.PickDrop;
import org.opentripplanner.model.fare.FareProductUse;
import org.opentripplanner.model.plan.Leg;
import org.opentripplanner.model.plan.LegTime;
import org.opentripplanner.model.plan.LegCallTime;
import org.opentripplanner.model.plan.Place;
import org.opentripplanner.model.plan.StopArrival;
import org.opentripplanner.model.plan.TransitLeg;
Expand Down Expand Up @@ -87,13 +87,13 @@ public Accessibility getTripWheelchairAccessibility() {
}

@Override
public LegTime start() {
return LegTime.ofStatic(startTime);
public LegCallTime start() {
return LegCallTime.ofStatic(startTime);
}

@Override
public LegTime end() {
return LegTime.ofStatic(endTime);
public LegCallTime end() {
return LegCallTime.ofStatic(endTime);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public ApiLeg mapLeg(

api.departureDelay = domain.getDepartureDelay();
api.arrivalDelay = domain.getArrivalDelay();
api.realTime = domain.getRealTime();
api.realTime = domain.isRealTimeUpdated();
api.isNonExactFrequency = domain.getNonExactFrequency();
api.headway = domain.getHeadway();
api.distance = round3Decimals(domain.getDistanceMeters());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public ApiWalkStep mapWalkStep(WalkStep domain) {
api.exit = domain.getExit();
api.stayOn = domain.isStayOn();
api.area = domain.getArea();
api.bogusName = domain.getBogusName();
api.bogusName = domain.nameIsDerived();
if (domain.getStartLocation() != null) {
api.lon = domain.getStartLocation().longitude();
api.lat = domain.getStartLocation().latitude();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ public RequestModes getRequestModes() {
mBuilder.withEgressMode(StreetMode.CAR_HAILING);
mBuilder.withDirectMode(StreetMode.WALK);
} else {
mBuilder.withAccessMode(StreetMode.WALK);
mBuilder.withTransferMode(StreetMode.WALK);
mBuilder.withEgressMode(StreetMode.WALK);
// This is necessary for transfer calculations.
mBuilder.withAccessMode(StreetMode.CAR);
mBuilder.withTransferMode(StreetMode.CAR);
mBuilder.withEgressMode(StreetMode.CAR);
mBuilder.withDirectMode(StreetMode.CAR);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import java.time.Instant;
import java.util.Locale;
import javax.annotation.Nullable;
import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLFilterPlaceType;
import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLFormFactor;
import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLInputField;
import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLRoutingErrorCode;
import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLTransitMode;
import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLWheelchairBoarding;
import org.opentripplanner.framework.i18n.I18NString;
import org.opentripplanner.model.StopTime;
import org.opentripplanner.routing.api.response.InputField;
import org.opentripplanner.routing.api.response.RoutingErrorCode;
import org.opentripplanner.routing.graphfinder.PlaceType;
Expand Down Expand Up @@ -109,4 +111,17 @@ public static boolean startsWith(String str, String name, Locale locale) {
public static boolean startsWith(I18NString str, String name, Locale locale) {
return str != null && str.toString(locale).toLowerCase(locale).startsWith(name);
}

/**
* Generally the missing values are removed during the graph build. However, for flex trips they
* are not and have to be converted to null here.
*/
@Nullable
public static Integer stopTimeToInt(int value) {
if (value == StopTime.MISSING_VALUE) {
return null;
} else {
return value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,22 @@
import org.opentripplanner.apis.gtfs.datafetchers.BikeRentalStationImpl;
import org.opentripplanner.apis.gtfs.datafetchers.BookingInfoImpl;
import org.opentripplanner.apis.gtfs.datafetchers.BookingTimeImpl;
import org.opentripplanner.apis.gtfs.datafetchers.CallScheduledTimeTypeResolver;
import org.opentripplanner.apis.gtfs.datafetchers.CallStopLocationTypeResolver;
import org.opentripplanner.apis.gtfs.datafetchers.CarParkImpl;
import org.opentripplanner.apis.gtfs.datafetchers.ContactInfoImpl;
import org.opentripplanner.apis.gtfs.datafetchers.CoordinatesImpl;
import org.opentripplanner.apis.gtfs.datafetchers.CurrencyImpl;
import org.opentripplanner.apis.gtfs.datafetchers.DefaultFareProductImpl;
import org.opentripplanner.apis.gtfs.datafetchers.DepartureRowImpl;
import org.opentripplanner.apis.gtfs.datafetchers.EstimatedTimeImpl;
import org.opentripplanner.apis.gtfs.datafetchers.FareProductTypeResolver;
import org.opentripplanner.apis.gtfs.datafetchers.FareProductUseImpl;
import org.opentripplanner.apis.gtfs.datafetchers.FeedImpl;
import org.opentripplanner.apis.gtfs.datafetchers.GeometryImpl;
import org.opentripplanner.apis.gtfs.datafetchers.ItineraryImpl;
import org.opentripplanner.apis.gtfs.datafetchers.LegImpl;
import org.opentripplanner.apis.gtfs.datafetchers.LegTimeImpl;
import org.opentripplanner.apis.gtfs.datafetchers.MoneyImpl;
import org.opentripplanner.apis.gtfs.datafetchers.NodeTypeResolver;
import org.opentripplanner.apis.gtfs.datafetchers.OpeningHoursImpl;
Expand All @@ -52,13 +56,15 @@
import org.opentripplanner.apis.gtfs.datafetchers.PlanConnectionImpl;
import org.opentripplanner.apis.gtfs.datafetchers.PlanImpl;
import org.opentripplanner.apis.gtfs.datafetchers.QueryTypeImpl;
import org.opentripplanner.apis.gtfs.datafetchers.RealTimeEstimateImpl;
import org.opentripplanner.apis.gtfs.datafetchers.RentalPlaceTypeResolver;
import org.opentripplanner.apis.gtfs.datafetchers.RentalVehicleImpl;
import org.opentripplanner.apis.gtfs.datafetchers.RentalVehicleTypeImpl;
import org.opentripplanner.apis.gtfs.datafetchers.RideHailingEstimateImpl;
import org.opentripplanner.apis.gtfs.datafetchers.RouteImpl;
import org.opentripplanner.apis.gtfs.datafetchers.RouteTypeImpl;
import org.opentripplanner.apis.gtfs.datafetchers.RoutingErrorImpl;
import org.opentripplanner.apis.gtfs.datafetchers.StopCallImpl;
import org.opentripplanner.apis.gtfs.datafetchers.StopGeometriesImpl;
import org.opentripplanner.apis.gtfs.datafetchers.StopImpl;
import org.opentripplanner.apis.gtfs.datafetchers.StopOnRouteImpl;
Expand All @@ -71,6 +77,7 @@
import org.opentripplanner.apis.gtfs.datafetchers.TranslatedStringImpl;
import org.opentripplanner.apis.gtfs.datafetchers.TripImpl;
import org.opentripplanner.apis.gtfs.datafetchers.TripOccupancyImpl;
import org.opentripplanner.apis.gtfs.datafetchers.TripOnServiceDateImpl;
import org.opentripplanner.apis.gtfs.datafetchers.UnknownImpl;
import org.opentripplanner.apis.gtfs.datafetchers.VehicleParkingImpl;
import org.opentripplanner.apis.gtfs.datafetchers.VehiclePositionImpl;
Expand Down Expand Up @@ -128,6 +135,8 @@ protected static GraphQLSchema buildSchema() {
.type("StopPosition", type -> type.typeResolver(new StopPosition() {}))
.type("FareProduct", type -> type.typeResolver(new FareProductTypeResolver()))
.type("AlertEntity", type -> type.typeResolver(new AlertEntityTypeResolver()))
.type("CallStopLocation", type -> type.typeResolver(new CallStopLocationTypeResolver()))
.type("CallScheduledTime", type -> type.typeResolver(new CallScheduledTimeTypeResolver()))
.type(typeWiring.build(AgencyImpl.class))
.type(typeWiring.build(AlertImpl.class))
.type(typeWiring.build(BikeParkImpl.class))
Expand Down Expand Up @@ -180,7 +189,12 @@ protected static GraphQLSchema buildSchema() {
.type(typeWiring.build(CurrencyImpl.class))
.type(typeWiring.build(FareProductUseImpl.class))
.type(typeWiring.build(DefaultFareProductImpl.class))
.type(typeWiring.build(TripOnServiceDateImpl.class))
.type(typeWiring.build(StopCallImpl.class))
.type(typeWiring.build(TripOccupancyImpl.class))
.type(typeWiring.build(LegTimeImpl.class))
.type(typeWiring.build(RealTimeEstimateImpl.class))
.type(typeWiring.build(EstimatedTimeImpl.class))
.build();
SchemaGenerator schemaGenerator = new SchemaGenerator();
return schemaGenerator.makeExecutableSchema(typeRegistry, runtimeWiring);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.opentripplanner.apis.gtfs.datafetchers;

import graphql.TypeResolutionEnvironment;
import graphql.schema.GraphQLObjectType;
import graphql.schema.GraphQLSchema;
import graphql.schema.TypeResolver;
import org.opentripplanner.apis.gtfs.model.ArrivalDepartureTime;

public class CallScheduledTimeTypeResolver implements TypeResolver {

@Override
public GraphQLObjectType getType(TypeResolutionEnvironment environment) {
Object o = environment.getObject();
GraphQLSchema schema = environment.getSchema();

if (o instanceof ArrivalDepartureTime) {
return schema.getObjectType("ArrivalDepartureTime");
}
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.opentripplanner.apis.gtfs.datafetchers;

import graphql.TypeResolutionEnvironment;
import graphql.schema.GraphQLObjectType;
import graphql.schema.GraphQLSchema;
import graphql.schema.TypeResolver;
import org.opentripplanner.transit.model.site.StopLocation;

public class CallStopLocationTypeResolver implements TypeResolver {

@Override
public GraphQLObjectType getType(TypeResolutionEnvironment environment) {
Object o = environment.getObject();
GraphQLSchema schema = environment.getSchema();

if (o instanceof StopLocation) {
return schema.getObjectType("Stop");
}
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.opentripplanner.apis.gtfs.datafetchers;

import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import java.time.Duration;
import java.time.OffsetDateTime;
import org.opentripplanner.apis.gtfs.generated.GraphQLDataFetchers;
import org.opentripplanner.transit.model.timetable.EstimatedTime;

public class EstimatedTimeImpl implements GraphQLDataFetchers.GraphQLEstimatedTime {

@Override
public DataFetcher<Duration> delay() {
return environment -> getSource(environment).delay();
}

@Override
public DataFetcher<OffsetDateTime> time() {
return environment -> getSource(environment).time().toOffsetDateTime();
}

private EstimatedTime getSource(DataFetchingEnvironment environment) {
return environment.getSource();
}
}
Loading
Loading