-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Initial support for Fares v2 validation. #1228
feat: Initial support for Fares v2 validation. #1228
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an official reviewer, but lgtm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @bdferris-v2 🔥
Two things:
-
We are missing documentation for
invalid_fare_transfer_rule_transfer_count
andfare_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.txt
is required if fare_attributes.txt is defined. - pseudo code: if
fare_attributes.txt
if present andfare_rules.txt
is absent, trigger the notice.
- spec mention in Dataset files:
forbidden_fare_rule_file
- spec mention in Dataset files:
fare_rules.txt
is forbidden iffare_attributes.txt
is not defined. - pseudo code: if
fare_attributes.txt
if absent andfare_rules.txt
is 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_limit
is 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
…s-validator into issue/1201/fares
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
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 test
to make sure you didn't break anything