gtfs-validator
gtfs-validator copied to clipboard
Translations.txt value mismatch not being recognized
Describe the bug
I'm not sure if this is a bug or just a missing validation rule. No validation error results from either field_name
referencing a value that doesn't exist or field_value
referencing a value that doesn't exist.
Example
routes.txt
...,route_short_name,
...
...,45,
...
translations.txt
...,field_value,
...
...,4r,
...
^ Validator does not detect that "4r" is not present under routes.route_short_name
.
or
...,field_name,
...
...,rt_shortname,
...
^ Validator does not detect that rt_shortname
is not present in routes.txt
.
or
...,field_name,
...,field_value,
...,route_long_name,
...,45,
^ Validator does not detect that 45
is not under ,route_long_name,
.
Steps/Code to Reproduce
- Use the above dataset.
- Notice errors in the first two records of translations.txt (route_short_name instead of route_long_name for the first record, incorrect
field_value
for the second record). - Run the dataset on GTFS Validator.
- Notice no error message about the two errors.
Expected Results
The Validator should detect these errors and produce an error message for each.
Actual Results
No detection, no error message for either.
Screenshots
No response
Files used
No response
Validator version
4.0.0
Operating system
MacOS
Java version
No response
Additional notes
No response
Thanks for opening your first issue in this project! If you haven't already, you can join our slack and join the #gtfs-validators channel to meet our awesome community. Come say hi :wave:!
Welcome to the community and thank you for your engagement in open source! :tada:
Upon reviewing our validation rules, it looks like this is a missing rule. We check
-
if the translation is for a table that doesn't exist
-
if a translation is for a record_id or record_sub_id that doesn't exist
No rule for if a translation is for a field value that doesn't exist. Language from spec: The field must have exactly the value defined in field_value. If only a subset of the value matches field_value, the translation won’t be applied.
Proposal: new rule: translation_unknown_field_value. A translation references an unknown or missing GTFS field value. Logic: IF field_value doesn't exist as specified by table_name and field_name = ERROR
Tasks
- [ ] Review community contrib PR (#1436) and respond
- [ ] Either code review + merge or implement
- [ ] Test with Weston's example feed
- [ ] Analyze acceptance tests
- [ ] Assess performance implications since the rule requires cross-checking