feat: recommended annotation#1149
Conversation
674c9f0 to
a80e4ae
Compare
maximearmstrong
left a comment
There was a problem hiding this comment.
Thank you for your contribution @KClough ! This is great work. Overall, if possible, it may be better to split this PR in two so that the notices are added in a second one. Otherwise, only a few comments before approval.
core/src/main/java/org/mobilitydata/gtfsvalidator/annotation/Recommended.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/mobilitydata/gtfsvalidator/notice/MissingRecommendedFieldNotice.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/mobilitydata/gtfsvalidator/notice/MissingRecommendedFileNotice.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/mobilitydata/gtfsvalidator/parsing/RowParser.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/mobilitydata/gtfsvalidator/parsing/RowParser.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/mobilitydata/gtfsvalidator/parsing/RowParser.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/mobilitydata/gtfsvalidator/notice/NoticeContainerTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/mobilitydata/gtfsvalidator/testgtfs/GtfsStopTableContainer.java
Show resolved
Hide resolved
main/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsFeedInfoSchema.java
Outdated
Show resolved
Hide resolved
processor/src/main/java/org/mobilitydata/gtfsvalidator/processor/TableLoaderGenerator.java
Outdated
Show resolved
Hide resolved
|
Sorry, it looks like I made a mistake when separating the PRs, I meant for this one to just have the annotation logic. I'll take another pass at it. |
|
No worries @KClough! I'll take a look at it right after. |
|
Hi @KClough, thanks for splitting the PRs, this makes it simpler :) Here is what I understand from the opened PRs:
If this is accurate, here are some changes to do, in order to make it easier when we look back at these PRs in the future:
|
e6ab070 to
3aee4bc
Compare
3aee4bc to
e994200
Compare
Resolved above.
I created a new PR for this: #1156 Sorry for the confusion. 😅 |
e994200 to
c41b7f4
Compare
|
Thank you for the changes @KClough! I believe we are missing a few things before we can merge:
|
|
@bdferris-v2, I've added you as a reviewer for this PR. If you get a chance to look at it, your feedback is welcome :) |
c41b7f4 to
1ecfcd2
Compare
maximearmstrong
left a comment
There was a problem hiding this comment.
2 things that should fix the checks that are failing right now.
| @Nullable | ||
| public String asPhoneNumber(int columnIndex, boolean required) { | ||
| return asValidatedString(columnIndex, required, fieldValidator::validatePhoneNumber); | ||
| public String asPhoneNumber(int columnIndex, FieldLevelEnum level) { |
| * | ||
| * <pre> | ||
| * {@literal @}GtfsTable(value = "feed_info.txt", singleRow = true) { | ||
| * @Recommended |
core/src/main/java/org/mobilitydata/gtfsvalidator/parsing/RowParser.java
Outdated
Show resolved
Hide resolved
bdferris-v2
left a comment
There was a problem hiding this comment.
I've got a high-level macro comment that may just highlight my ignorance of how this code works, but let me give it a shot.
I feel like there is a model mismatch in how you are treating Required vs Recommended vs Optional in this PR. On one hand, you've got the file and field descriptors, which have separate booleans for isRequired() and isRecommended(). On the other hand, you've introduced a new FieldLevelEnum for passing into RowParser specifying the acceptance level for a given field. This PR, as best I can tell, doesn't actually update the logic in TableLoaderGenerator for setting that FieldLevelEnum when calling RowParser methods, instead relying on the existing isRequired() method and switching between REQUIRED or OPTIONAL, but never actually passing in RECOMMENDED. Maybe that's a function of the way you split up the PR into parts?
So at a tactical level, I think it would be good to update that logic in this PR.
But more generally, it made me wonder how this should actually be modeled overall. So I have questions like:
- Are all Required fields also Recommended by implication?
- Should the boolean isRequired() and isRecommended() methods in the descriptors be refactored to use FieldLevelEnum directly instead as a single state?
|
@bdferris-v2 Very good point, I hadn't noticed that this logic implementation was missing in For your questions
|
|
To answer this first point, I agree with what @maximearmstrong said above. If a file is required, we could say it is also recommended by implication but we don't want to trigger the |
1ecfcd2 to
0366131
Compare
|
@bdferris-v2 it looks like I messed up this PR when splitting out notices from annotations. I think we're in good spot now. @maximearmstrong I believe I've resolved all javaDoc issues. The build step passes locally for me. Once this PR is merged, I'll rebase my other PRs and resolve any other outstanding issues. |
|
Apologies, but I think my original concern still exists. Namely, you've updated all the methods in Specifically, TableLoaderGenerator L331: That's the piece I'm still looking for in this PR. |
0366131 to
e4fa082
Compare
|
@bdferris-v2 thanks for catching that, I had that line in my notice implementation and missed pulling it over. I've updated my last commit to include that change. |
processor/src/main/java/org/mobilitydata/gtfsvalidator/processor/TableLoaderGenerator.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/mobilitydata/gtfsvalidator/parsing/RowParser.java
Outdated
Show resolved
Hide resolved
e4fa082 to
73beb3b
Compare
|
Thanks for following-up on this @bdferris-v2! |
maximearmstrong
left a comment
There was a problem hiding this comment.
Thank you @KClough and @bdferris-v2! The build passes for me as well. We are ready to merge 🎉
@isabelle-dr I don't think we need to open an issue to re-iterate the logic for adding the @recommended annotation. I think this implementation works well.
Summary:
Related to issue #885
Adds a new annotation for recommended fields
Expected behavior:
Provides additional functionality around the
recommendedannotation. It can now be applied to fields.Please make sure these boxes are checked before submitting your pull request - thanks!
gradle testto make sure you didn't break anything- [ ] Include screenshot(s) showing how this pull request works and fixes the issue(s)@isabelle-dr per your request, this pull request contains just the annotation. I don't think a screenshot makes sense in this scenario.