Skip to content

Fix flexible quay querying in Transmodel API - #5417

Merged
vpaturet merged 2 commits into
opentripplanner:dev-2.xfrom
entur:fix_flex_quay_query
Oct 13, 2023
Merged

Fix flexible quay querying in Transmodel API#5417
vpaturet merged 2 commits into
opentripplanner:dev-2.xfrom
entur:fix_flex_quay_query

Conversation

@vpaturet

@vpaturet vpaturet commented Oct 11, 2023

Copy link
Copy Markdown
Contributor

Summary

When querying a flexible quay in the Transmodel API:

query {
  quay(
    id: "SOF:FlexibleStopPlace:ef157b1b-58d7-4431-942d-dc6042f4cae3"
  ) {
    name
    id
    estimatedCalls {
      expectedDepartureTime
      destinationDisplay {
        frontText
      }
      serviceJourney {
        line {
          publicCode
          transportMode
        }
      }
    }
  }
}

an exception is thrown:

Exception while fetching data (/quays[100689]/estimatedCalls) : class org.opentripplanner.transit.model.site.AreaStop cannot be cast to class org.opentripplanner.transit.model.site.RegularStop (org.opentripplanner.transit.model.site.AreaStop and org.opentripplanner.transit.model.site.RegularStop are in unnamed module of loader 'app')
java.lang.ClassCastException: class org.opentripplanner.transit.model.site.AreaStop cannot be cast to class org.opentripplanner.transit.model.site.RegularStop (org.opentripplanner.transit.model.site.AreaStop and org.opentripplanner.transit.model.site.RegularStop are in unnamed module of loader 'app')
	at org.opentripplanner.ext.transmodelapi.model.stop.QuayType.lambda$create$11(QuayType.java:320)
	at graphql.execution.ExecutionStrategy.invokeDataFetcher(ExecutionStrategy.java:311)
	at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:287)
	at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:213)
	at graphql.execution.AsyncExecutionStrategy.execute(AsyncExecutionStrategy.java:55)
	at graphql.execution.ExecutionStrategy.completeValueForObject(ExecutionStrategy.java:702)
	at graphql.execution.ExecutionStrategy.completeValue(ExecutionStrategy.java:484)
	at graphql.execution.ExecutionStrategy.completeValueForList(ExecutionStrategy.java:586)
	at graphql.execution.ExecutionStrategy.completeValueForList(ExecutionStrategy.java:543)
	at graphql.execution.ExecutionStrategy.completeValue(ExecutionStrategy.java:469)
	at graphql.execution.ExecutionStrategy.completeField(ExecutionStrategy.java:435)
	at graphql.execution.ExecutionStrategy.lambda$resolveFieldWithInfo$1(ExecutionStrategy.java:215)
	at java.base/java.util.concurrent.CompletableFuture.uniApplyNow(CompletableFuture.java:684)
	at java.base/java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:662)
	at java.base/java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:2168)
	at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:214)
	at graphql.execution.AsyncExecutionStrategy.execute(AsyncExecutionStrategy.java:55)
	at graphql.execution.Execution.executeOperation(Execution.java:161)
	at graphql.execution.Execution.execute(Execution.java:103)
	at graphql.GraphQL.execute(GraphQL.java:565)
	at graphql.GraphQL.lambda$parseValidateAndExecute$12(GraphQL.java:484)
	at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187)
	at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309)
	at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:479)
	at graphql.GraphQL.executeAsync(GraphQL.java:438)
	at graphql.GraphQL.execute(GraphQL.java:365)
	at org.opentripplanner.ext.transmodelapi.TransmodelGraph.executeGraphQL(TransmodelGraph.java:67)
	at org.opentripplanner.ext.transmodelapi.TransmodelAPI.getGraphQL(TransmodelAPI.java:122)

This PR makes it possible to query flexible quays.

Issue

No.

Unit tests

Documentation

No.

@vpaturet vpaturet added the !Bug Apply to issues describing a bug and PRs witch fixes it. label Oct 11, 2023
@vpaturet vpaturet self-assigned this Oct 11, 2023
@vpaturet
vpaturet marked this pull request as ready for review October 11, 2023 07:00
@vpaturet
vpaturet requested a review from a team as a code owner October 11, 2023 07:00
@codecov

codecov Bot commented Oct 11, 2023

Copy link
Copy Markdown

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (9695a96) 66.59% compared to head (75d5a8d) 66.59%.
Report is 3 commits behind head on dev-2.x.

Additional details and impacted files
@@            Coverage Diff             @@
##             dev-2.x    #5417   +/-   ##
==========================================
  Coverage      66.59%   66.59%           
  Complexity     15284    15284           
==========================================
  Files           1790     1790           
  Lines          69388    69386    -2     
  Branches        7308     7308           
==========================================
- Hits           46206    46205    -1     
+ Misses         20703    20702    -1     
  Partials        2479     2479           
Files Coverage Δ
...planner/ext/transmodelapi/model/stop/QuayType.java 75.20% <27.27%> (+0.59%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vpaturet vpaturet changed the title Fix flexible quay querying in Tranmodel API Fix flexible quay querying in Transmodel API Oct 11, 2023
@t2gran t2gran added this to the 2.5 (next release) milestone Oct 12, 2023
@vpaturet
vpaturet merged commit acc39ba into opentripplanner:dev-2.x Oct 13, 2023
t2gran pushed a commit that referenced this pull request Oct 13, 2023
@vpaturet
vpaturet deleted the fix_flex_quay_query branch October 16, 2023 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!Bug Apply to issues describing a bug and PRs witch fixes it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants