Skip to content
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

fix: byTranslationKey() for multi-key schemas without translations.txt support #1302

Merged
merged 2 commits into from
Dec 15, 2022

Conversation

bdferris-v2
Copy link
Collaborator

The @PrimaryKey(translationRecordIdType) field is used to indicated which keys, if any, for a given GTFS entity can be used for performing translations.txt lookups via byTranslationKey() methods generated in the table container. Currently, code in TableContainerIndexGenerator will generate an implementation for byTranslationKey() even if none of the @PrimaryKey fields have been marked as the translation RECORD_ID. This can lead to some weird behavior where the method will return a value even if none should be returned or generate code that does not actually compile.

This PR fixes this behavior by no longer generating a byTranslationKey() implementation if the entity type does not support. Instead, empty is returned.

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with gradle test to make sure you didn't break anything
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).

…key schemas that do not have any translation record id annotations.
Copy link
Collaborator

@asvechnikov2 asvechnikov2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@github-actions
Copy link
Contributor

✅ Rule acceptance tests passed.
New Errors: 0 out of 1374 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1374 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1374 sources (~0 %) are corrupted.
Commit: d7d845c
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

@bdferris-v2 bdferris-v2 merged commit bcc3215 into master Dec 15, 2022
@bdferris-v2 bdferris-v2 deleted the issue/1301/translations_key branch December 15, 2022 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants