-
Notifications
You must be signed in to change notification settings - Fork 100
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: Validate field presence and key integrity for translations.txt #968
feat: Validate field presence and key integrity for translations.txt #968
Conversation
core/src/main/java/org/mobilitydata/gtfsvalidator/validator/ValidatorLoader.java
Outdated
Show resolved
Hide resolved
processor/src/main/java/org/mobilitydata/gtfsvalidator/processor/TableContainerGenerator.java
Outdated
Show resolved
Hide resolved
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 @aababilov for this contribution! I like how this adapts to unofficial tables! You will find a few questions in-line.
Could you also add documentation for the new classes/methods as well as unit test for TranslationValidator
please? :)
Thank you for this contribution @aababilov! |
|
||
/** | ||
* Validates that translations are provided in accordance with GTFS Specification. Supports two | ||
* types of specifications * unofficial Google extension * official GTFS specification Checks that |
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.
unofficial Google extension
Is this extension documented somewhere that you could link to from here?
Also, it looks like the auto-formatting destroyed the bulleted list here - I'd suggest re-formatting in a way that keeps the list and complies with the Google Java Format.
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.
@lionel-nj As you work on profiles, perhaps pulling checks for the unofficial Google extension into a profile would be a good use case?
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.
Sorry for bad formatting!
Google translation.txt extension is hard to support in open-source since the "Google" translations.txt has different columns:
trans_id
lang
(notlanguage
!)translation
Fields table_name
, field_name
and language
are required in GTFS standard but not used in Google extension. So, it is not enough to add a plugin for validation of Google translations - instead, the schema has to be patched and officially required fields become optional in order to support Google translations.
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.
@barbeau since this extension requires modification of schema we might consider a more simple use case for the first implementation of profiles custom validators.
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.
@aababilov I see. So is the comment wrong, the Google extension isn't supported here?
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.
Yes, that was a bad copypaste from the internal code. Fixed.
My pleasure! |
I am splitting this change into pieces. #979 |
4258282
to
2fb6a03
Compare
Please take another look. |
2fb6a03
to
0bb442d
Compare
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.
Thank you for exporting this, looks much better with GtfsFeedContainer! LGTM!
...ain/java/org/mobilitydata/gtfsvalidator/validator/TranslationFieldAndReferenceValidator.java
Outdated
Show resolved
Hide resolved
Thanks for review! |
Checks that fields and values provided in translations are correct and checks that a
translation references existing entity.
This validator gracefully handles legacy Google translations format. If translations.txt
does not follow the new format, then no validations are performed.