-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add query for cancelled trips to GTFS GraphQL API #5393
Merged
tkalvas
merged 57 commits into
opentripplanner:dev-2.x
from
HSLdevcom:gtfsgraphql-cancelled-trips
Dec 16, 2024
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
4b052d5
Draft upcoming cancelled trips query
vesameskanen 2e6529e
Remove duplicate imports
vesameskanen 627d251
Node resolver for DatedTrip
vesameskanen 6c26434
Hook in DatedTrip data fetcher
vesameskanen fb71d74
Feed filtering parameter for cancelled trips query
vesameskanen 184e7e2
More efficient iteration over all trips
vesameskanen 2787b7e
Sort cancelled trips by ascending time
vesameskanen 58f0387
Move filtering by feed into transit service
vesameskanen 3388c15
Merge remote-tracking branch 'otp/dev-2.x' into gtfsgraphql-cancelled…
vesameskanen 45aacde
Merge remote-tracking branch 'otp/dev-2.x' into gtfsgraphql-cancelled…
vesameskanen a1fe6e3
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome 20df02b
Use LocalDate for date and include trip's fields instead of trip
optionsome 2a9df2a
Improve documentation and mark cancelledTripTimes as deprecated
optionsome b142bdf
Add start and end to schema
optionsome 8e12d3a
Create DatedStopTime type and use it in DatedTrip
optionsome 53ff5d5
cancelled -> canceled
optionsome 0469361
Add graphql test
optionsome c0648b7
Rename method
optionsome 6437bd7
Add small tests
optionsome 6e143d9
Realtime -> RealTime
optionsome 1de24b2
Add more tests
optionsome 7251391
Refactor canceled trips fetching to be more efficient
optionsome bedee96
Update and fix tests
optionsome c0768e0
Create an union for dated stoptimes
optionsome 66100b9
Use TripOnServiceDate and redesign schema
optionsome 284c483
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome 079485e
Remove stuff from new stoptime type
optionsome c15a29e
Mark stopTimes as non-null
optionsome 65927c6
Do less inside timetable snapshot provider initialization
optionsome 9c124df
Minor fixes
optionsome 9e5eb14
Rename FixedDatedStopTime -> FixedStopTimeOnServiceDate
optionsome c8924fc
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome 7f1948e
Run codegen
optionsome 7ed48c3
Improve schema doc and mark some fields as non-null
optionsome 2797fa5
Slightly refactor methods to fetch cancelled trips
optionsome a2b30f8
Improve schema doc
optionsome 6eaef7a
Rename date -> serviceDate
optionsome 396c43c
Rename ArrivalDepartureTime -> FixedArrivalDepartureTime and LegTime …
optionsome be25fe3
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome 672a968
Make TripOnServiceDate an interface and rename some types
optionsome ec59d99
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome 8885c19
Rename RegularArrivalDepartureTime -> LegCallTime
optionsome c7d6d43
Refactor LegCallTime
optionsome 178c150
Rename StopTime -> StopCall etc. and create own model for its times
optionsome 349efb6
Create implementations for call times
optionsome 405f580
Remove support for feeds argument
optionsome ac21d8a
Improve doc
optionsome ca53100
Redesign schema
optionsome 45a01af
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome de5758b
Add module test for listing canceled trips
leonardehrenfried e6c0036
Remove duplication
leonardehrenfried bee85de
Renaming or ordering
optionsome dba65b0
Update application/src/main/resources/org/opentripplanner/apis/gtfs/s…
optionsome b3bad26
Implement new schema design
optionsome ff426dc
Merge remote-tracking branch 'upstream/dev-2.x' into gtfsgraphql-canc…
optionsome 6a485a3
Minor schema doc fixes
optionsome 5217ce5
Formatting
optionsome File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...c/main/java/org/opentripplanner/apis/gtfs/datafetchers/CallScheduledTimeTypeResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...rc/main/java/org/opentripplanner/apis/gtfs/datafetchers/CallStopLocationTypeResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/EstimatedTimeImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/LegTimeImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.OffsetDateTime; | ||
import org.opentripplanner.apis.gtfs.generated.GraphQLDataFetchers; | ||
import org.opentripplanner.model.plan.LegCallTime; | ||
import org.opentripplanner.model.plan.LegRealTimeEstimate; | ||
|
||
public class LegTimeImpl implements GraphQLDataFetchers.GraphQLLegTime { | ||
|
||
@Override | ||
public DataFetcher<LegRealTimeEstimate> estimated() { | ||
return environment -> getSource(environment).estimated(); | ||
} | ||
|
||
@Override | ||
public DataFetcher<OffsetDateTime> scheduledTime() { | ||
return environment -> getSource(environment).scheduledTime().toOffsetDateTime(); | ||
} | ||
|
||
private LegCallTime getSource(DataFetchingEnvironment environment) { | ||
return environment.getSource(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice.