MobilityData / gtfs-validator

Canonical GTFS Validator project for schedule (static) files.
https://gtfs-validator.mobilitydata.org/
Apache License 2.0
290 stars 101 forks source link

Only raise a foreign key violation error when network_id is missing from both networks.txt and routes.txt #1764

Closed qcdyx closed 3 months ago

qcdyx commented 6 months ago

Describe the problem

The network_id field of GtfsFareLegRule is a foreign key that references routes.txt. If should reference both routes.txt and networks.txt. cc @tzujenchanmbd

Proposed solution

networkId is declared as a foreign key that references the network_id field in both the routes.txt and networks.txt tables.

Logic:

IF network_id exists in fare_leg_rules.txt but not in routes.txt OR networks.txt, generate a foreign_key_violation notice.

Alternatives you've considered

No response

Additional context

No response

emmambd commented 6 months ago

Answers to some questions @davidgamez @qcdyx shared on this issue:

Based on this, do you need anything else clarified before I rewrite the issue to specify 1. we need to change foreign_key_violation to omit network_id 2. we need to add a new rule to check this conditional?

emmambd commented 5 months ago

Closing #1764 as duplicate of #1756

Alessandro100 commented 3 months ago

Tasks [] Only raise a foreign key violation error when network_id is missing from both networks.txt and routes.txt [] Review auto generated documentation and add / update if needed [] Test with (test GTFS.zip) [] Review acceptance tests