Fix 1198: separate required column from required value#1344
Fix 1198: separate required column from required value#1344isabelle-dr merged 7 commits intomasterfrom
Conversation
|
@bdferris-v2 As this uses code generation, I was unsure if/how we could add tests for this. Please let me know if you have thoughts. |
|
✅ Rule acceptance tests passed. |
core/src/main/java/org/mobilitydata/gtfsvalidator/annotation/RequiredColumn.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/mobilitydata/gtfsvalidator/validator/DefaultTableHeaderValidator.java
Outdated
Show resolved
Hide resolved
|
Regarding testing, could you introduce a test case in processor/tests with a test schema that exercises the @RequiredColumn behavior? |
0c37195 to
7b3310d
Compare
7b3310d to
4d8c2fb
Compare
|
@bdferris-v2 I added tests for both |
|
✅ Rule acceptance tests passed. |
core/src/main/java/org/mobilitydata/gtfsvalidator/annotation/Required.java
Outdated
Show resolved
Hide resolved
|
✅ Rule acceptance tests passed. |
|
Just a side thought: We have a missing_required_column in this validator, and it is triggered when the whole column is missing (as opposed to a missing required field in a given row). Merging this PR, thank you @briandonahue! |
|
✅ Rule acceptance tests passed. |
|
@briandonahue could you resolve the conflicts? :) |
@isabelle-dr done! |
|
✅ Rule acceptance tests passed. |
|
Thank you for this awesome contribution @briandonahue! ✨ |
…1344) * feat: separate required column from required value. * Use better example in annotation docs * rename parameters back to *Columns * Adding test for RequiredColumn and Required Annotations * punctuation --------- Co-authored-by: isabelle-dr <[email protected]>
Summary:
Closes #1198. Added a new annotation
@RequiredColumnto allow for scenario where a column must exist in the file, but values for that column may be empty.It may be useful in the future to separate the existing
@Requiredannotation into@RequiredFileand@RequiredValueannotations. I've opened #1343 for discussion of that topic.Expected behavior:
Given the following
transfers.txtfile, the following should not throw an error:This is a valid use case according to the spec in that the transfer_type value is empty which indicates a "Recommended transfer point between routes".
Please make sure these boxes are checked before submitting your pull request - thanks!
gradle testto make sure you didn't break anything