feat: Initial support for Fares v2 validation.#1228
feat: Initial support for Fares v2 validation.#1228isabelle-dr merged 21 commits intoMobilityData:masterfrom
Conversation
|
Initial draft, mostly to see what happens when validating a few existing feeds. |
processor/src/main/java/org/mobilitydata/gtfsvalidator/processor/GtfsAnnotationProcessor.java
Outdated
Show resolved
Hide resolved
|
|
||
| @PrimaryKey(translationRecordIdType = UNSUPPORTED) | ||
| @Positive | ||
| int durationLimit(); |
There was a problem hiding this comment.
Just a question: if we have a negative integer in this field, will this trigger the invalid_integer notice?
There was a problem hiding this comment.
I can confirm it triggers at number_out_of_range validation error.
|
Now that #1248 has been committed and integrated, this PR is ready for official review. |
KClough
left a comment
There was a problem hiding this comment.
Not an official reviewer, but lgtm.
There was a problem hiding this comment.
Thanks, @bdferris-v2 🔥
Two things:
-
We are missing documentation for
invalid_fare_transfer_rule_transfer_countandfare_transfer_rule_missing_transfer_count. -
I would like to include three additional rules in the scope of this PR.
missing_fare_rule_file- spec mention in Dataset files:
fare_rules.txtis required if fare_attributes.txt is defined. - pseudo code: if
fare_attributes.txtif present andfare_rules.txtis absent, trigger the notice.
- spec mention in Dataset files:
forbidden_fare_rule_file- spec mention in Dataset files:
fare_rules.txtis forbidden iffare_attributes.txtis not defined. - pseudo code: if
fare_attributes.txtif absent andfare_rules.txtis present, trigger the notice.
- spec mention in Dataset files:
fare_transfer_rule_forbidden_duration_limit- spec mention in
fare_transfer_rules.duration_limit_type: Forbidden iffare_transfer_rules.duration_limitis empty. - pseudo code: If [
fare_transfer_rules.duration_limit== '' andfare_transfer_rules.duration_limit_type!= ''], trigger the notice
- spec mention in
I have a copy of the fares v2 spec changes with my comments in https://bit.ly/faresv2-validator.
@isabelle-dr I think this has been already added with the |
maximearmstrong
left a comment
There was a problem hiding this comment.
Great work! I've only one small comment. I think after Isabelle's requested changes are done, we'll be ready to merge. Thanks @bdferris-v2
...in/java/org/mobilitydata/gtfsvalidator/validator/FareTransferRuleTransferCountValidator.java
Outdated
Show resolved
Hide resolved
|
I believe @isabelle-dr was correct that I didn't have a validation check for when I believe all validation rules have documentation in RULES.md at this point. Let me know if you see things differently. As for |
isabelle-dr
left a comment
There was a problem hiding this comment.
Hello! Thanks for making this advance 🙏
For the documentation, I believe we are still missing the first rule you have in FareTransferCountValidator.java (line 47). It is invalid_fare_transfer_rule_transfer_count.
As for the two additional rules I mentioned here, I see fare_rules.txt was introduced in Fares v1, but it went from being optional to conditionally required/forbidden in the PR that added GTFS-Fares v2 base implementation on google/transit (reference).
If the scope of this PR is adding validation for the changes introduced in this PR, I would say it's in scope.
...in/java/org/mobilitydata/gtfsvalidator/validator/FareTransferRuleTransferCountValidator.java
Outdated
Show resolved
Hide resolved
…ing conventions of other notices. Add documentation RULES.md.
Per issue #1201, adds validation for files and fields added for Fares v2 base spec changes.
Please make sure these boxes are checked before submitting your pull request - thanks!
gradle testto make sure you didn't break anything