opentripplanner / OpenTripPlanner

An open source multi-modal trip planner
http://www.opentripplanner.org
Other
2.22k stars 1.03k forks source link

Leg id causes fare conflicts because of relay conventions #6222

Closed vesameskanen closed 6 days ago

vesameskanen commented 1 week ago

Expected behavior

Leg fares can be queried using relay graphql client

Observed behavior

Relay changes conflicting fare ids thus breaking the fares

Version of OTP used (exact commit hash or JAR name)

otp-2.7.0-SNAPSHOT-shaded.jar

Data sets in use (links to GTFS and OSM PBF files)

Any GTFS with fares v1

Command line used to start OTP

Irrelevant

Router config and graph build config JSON

Irrelevant

Steps to reproduce the problem

Make itinerary search which requests leg id and fares, and where some itineraries share an identical transit leg:

itinerary1: TransitLegA - TransitLegB itinerary2: TransitLegA - TransitLegC

Pull request https://github.com/opentripplanner/OpenTripPlanner/pull/6045 added an id field to legs. Unfortunately a popular graphQl client Relay considers such a field name as an unique identifier for received data records. Two legs with same id must have identical content. However, otherwise identical legs may have different fares as the fares are computed independently for each itinerary. Relay considers this as a conflic state and changes the received fare information. Ticket information becomes unreliable/unusable.

Changing the leg identifier to something else - say legId - fixes the problem.

vesameskanen commented 6 days ago

Use of graphQL alias for leg id fixes the issue.