feat: require shape_id when a trip has continuous pickup or drop-off - #2173
Open
vssinghh wants to merge 1 commit into
Open
feat: require shape_id when a trip has continuous pickup or drop-off#2173vssinghh wants to merge 1 commit into
vssinghh wants to merge 1 commit into
Conversation
|
Thanks for opening this pull request! You're awesome. We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of titles with semantic prefixes:
|
The spec makes trips.shape_id conditionally required: it is required if the trip has continuous pickup or drop-off behavior defined in routes.txt or in stop_times.txt. GtfsTripSchema already annotates shapeId as @ConditionallyRequired, but nothing enforced it. Adds TripShapeIdConditionalValidator, which emits the existing MissingRequiredFieldNotice when such a trip has no shape_id. This follows TransferStopIdsConditionalValidator and StopTimesGeographyIdPresenceValidator, which raise the generic notice under a conditional rather than defining a new notice type. A value of 1 is treated like an empty value, since the reference defines both as no continuous stopping behavior. Values in stop_times.txt override those in routes.txt. Closes MobilityData#1785
vssinghh
force-pushed
the
feat/shape-id-required-for-continuous
branch
from
August 22, 2026 04:36
71149cb to
58bcaef
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary:
The spec makes
trips.shape_idconditionally required: required if the trip has continuous pickup or drop-off behavior defined either inroutes.txtor instop_times.txt, optional otherwise.GtfsTripSchemaalready annotatesshapeIdas@ConditionallyRequired, but nothing enforced it.Adds
TripShapeIdConditionalValidator, which raises the existingmissing_required_fieldnotice (ERROR) ontrips.shape_idwhen such a trip has no shape. This followsTransferStopIdsConditionalValidatorandStopTimesGeographyIdPresenceValidator, which raise the generic notice under a conditional rather than defining a new notice type.Two readings, both taken from the reference:
1and empty both mean no continuous stopping behavior, so only0,2and3makeshape_idrequired.stop_timesvalues overrideroutesvalues, so the effective value for each stop time is thestop_timesvalue where set, otherwise the route value.Expected behavior:
Running the CLI on four variants of the
Archive.zipfrom #1785:routes.continuous_pickupstop_times.continuous_pickup1(as attached)1(as attached)0110missing_required_fieldontrips.txtrow 20missing_required_fieldontrips.txtrow 2Worth noting that the archive attached to the issue has
continuous_pickup=1andcontinuous_drop_off=1in every row of both files, so as attached it does not exercise the rule.8 unit tests cover the four combinations plus the shape present, no continuous behavior, and no stop times cases.
Closes #1785
Please make sure these boxes are checked before submitting your pull request - thanks!
gradle testto make sure you didn't break anything