From b7d0dbe8b60a58ac3fb30c4e885c7e57d899acd0 Mon Sep 17 00:00:00 2001 From: Michael Tsang Date: Tue, 5 Nov 2024 13:52:12 +0000 Subject: [PATCH] rename stopIndex to stopPositionInPattern stopIndex is considered an implementation detail in OTP which shouldn't be exposed, while stopPositionInPattern is guaranteed to run from 0 to n-1. --- .../apis/gtfs/datafetchers/StoptimeImpl.java | 8 +++---- .../gtfs/generated/GraphQLDataFetchers.java | 4 ++-- .../apis/gtfs/generated/GraphQLTypes.java | 1 - .../opentripplanner/apis/gtfs/schema.graphqls | 21 ++++++++++--------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimeImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimeImpl.java index debeef1d340..d7c8e97e255 100644 --- a/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimeImpl.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimeImpl.java @@ -86,13 +86,13 @@ public DataFetcher scheduledDeparture() { } @Override - public DataFetcher stopIndex() { - return environment -> getSource(environment).getStopIndex(); + public DataFetcher stopPosition() { + return environment -> getSource(environment).getGtfsSequence(); } @Override - public DataFetcher stopPosition() { - return environment -> getSource(environment).getGtfsSequence(); + public DataFetcher stopPositionInPattern() { + return environment -> getSource(environment).getStopIndex(); } @Override diff --git a/application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java index fc77fd37031..dffd892e7ee 100644 --- a/application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java @@ -1093,10 +1093,10 @@ public interface GraphQLStoptime { public DataFetcher stop(); - public DataFetcher stopIndex(); - public DataFetcher stopPosition(); + public DataFetcher stopPositionInPattern(); + public DataFetcher timepoint(); public DataFetcher trip(); diff --git a/application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java index 8c3bf39a75e..48d60701a96 100644 --- a/application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java @@ -1,7 +1,6 @@ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. package org.opentripplanner.apis.gtfs.generated; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; diff --git a/application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls b/application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls index cf1ad2b591c..e3871a5ed6c 100644 --- a/application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls +++ b/application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls @@ -2195,18 +2195,10 @@ type Stoptime { "The stop where this arrival/departure happens" stop: Stop """ - The index of the stop in the pattern. This is required to start from 0 and be consecutive. - - The purpose of this field is to identify the position of the stop within the pattern so it can be - cross-referenced between different trips on the same pattern, as stopPosition can be different - between trips even within the same pattern. - """ - stopIndex: Int! - """ - The sequence of the stop in the pattern. This is not required to start from 0 or be consecutive - any + The sequence of the stop in the trip. This is not required to start from 0 or be consecutive - any increasing integer sequence along the stops is valid. - The purpose of this field is to identify the stop within the pattern so it can be cross-referenced + The purpose of this field is to identify the stop within the trip so it can be cross-referenced between it and the itinerary. It is safe to cross-reference when done quickly, i.e. within seconds. However, it should be noted that real-time updates can change the values, so don't store it for longer amounts of time. @@ -2215,6 +2207,15 @@ type Stoptime { even generated. """ stopPosition: Int + """ + The position of the stop in the pattern. This is required to start from 0 and be consecutive along + the pattern, up to n-1 for a pattern with n stops. + + The purpose of this field is to identify the position of the stop within the pattern so it can be + cross-referenced between different trips on the same pattern, as stopPosition can be different + between trips even within the same pattern. + """ + stopPositionInPattern: Int! "true, if this stop is used as a time equalization stop. false otherwise." timepoint: Boolean "Trip which this stoptime is for"