Skip to content

File shapes.txt should be Conditionally Required #643

Open

Description

@fabianabarca

Describe the problem

The field trips. shape_id (a foreign ID referencing shapes.shape_id) is Conditionally Required, with the following condition:

Required if the trip has a continuous pickup or drop-off behavior defined either in routes.txt or in stop_times.txt

When that condition is true, shapes.txt becomes required as well, because trips.shape_id cannot be valid without a corresponding shapes.shape_id value.

Use cases

It is relevant for consumers when planning the database schemas, and for evaluating correctness of the feed.

Proposed solution

I see two possible paths:

  1. Preferred: make shapes.txt conditionally required

Mark shapes.txt as Conditionally Required in the Presence column of the Dataset Files table (GTFS Schedule), with this condition:

Required if the trip has a continuous pickup or drop-off behavior defined either in routes.txt or in stop_times.txt.

This matches the existing condition on trips.shape_id and makes the transitive requirement explicit.

  1. Alternative: remove the reference from trips.shape_id

If shapes.txt is not intended to become conditionally required under that condition, then trips.shape_id should not be a Foreign ID in trips.txt. In that case, its Type should be changed to Text (similar to direction_id), because there would be no guaranteed referenced table.

Additional information

This issue is related to #459, but it has a different purpose, as that one aims to include shapes.txt in the recommended tables.

As mentioned in the discussion of that issue, 85% of the feeds in the Mobility Database (as of May 2024) already have shapes.txt. Therefore, it shouldn’t be a significant change for producers to mark it as Conditionally Required.

Activity

  1. fabianabarca commented on Jun 20, 2026

    @fabianabarca
    ContributorAuthor

    I noticed that there is the option "Recommended" in the "Presence" column for some fields, for example for feed_info. feed_start_date. As a third proposed solution, shapes.txt could be marked as "Recommended" in the Dataset Files table, as long as that's a valid option for the presence of files. Still, my preferred option is "Conditionally Required", due to the transitive requirement discussed above.

  2. etienne0101 commented on Jul 2, 2026

    @etienne0101
    Collaborator

    Hello @fabianabarca and thanks for opening this issue! Feel free to reach out if you need any guidance on contributing to GTFS.

    Once you feel ready, and ideally after this issue has had some discussion (though that's not required), feel free to open a proposal for this change.

    Since this looks like a fix for a gap in the spec, you could make the case for it being a documentation change or a non-functional change. In that case, it would need either no vote or just one vote.

    That said, a suggestion for your change is the following:

    Conditionally Required:

    • Required if ...
    • Recommended otherwise
  3. fabianabarca commented on Jul 2, 2026

    @fabianabarca
    ContributorAuthor

    Thanks @etienne0101 for the reply! I understand, and it makes sense to present it as a documentation or non-functional change. I will wait a bit for any other comment but otherwise I will open a PR with the proposal, following your suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions