Skip to content

Fix 1198: separate required column from required value#1344

Merged
isabelle-dr merged 7 commits intomasterfrom
issue/1198/required_field_transfer_type
Mar 10, 2023
Merged

Fix 1198: separate required column from required value#1344
isabelle-dr merged 7 commits intomasterfrom
issue/1198/required_field_transfer_type

Conversation

@briandonahue
Copy link
Copy Markdown
Contributor

Summary:

Closes #1198. Added a new annotation @RequiredColumn to 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 @Required annotation into @RequiredFile and @RequiredValue annotations. I've opened #1343 for discussion of that topic.

Expected behavior:

Given the following transfers.txt file, the following should not throw an error:

from_stop_id,to_stop_id,transfer_type,min_transfer_time
1,2,,

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!

@briandonahue
Copy link
Copy Markdown
Contributor Author

@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.

@github-actions
Copy link
Copy Markdown
Contributor

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

@bdferris-v2
Copy link
Copy Markdown
Collaborator

Regarding testing, could you introduce a test case in processor/tests with a test schema that exercises the @RequiredColumn behavior?

@briandonahue briandonahue force-pushed the issue/1198/required_field_transfer_type branch from 0c37195 to 7b3310d Compare March 1, 2023 16:59
@briandonahue briandonahue force-pushed the issue/1198/required_field_transfer_type branch from 7b3310d to 4d8c2fb Compare March 1, 2023 17:00
@briandonahue
Copy link
Copy Markdown
Contributor Author

@bdferris-v2 I added tests for both @Required and @RequiredColumn annotations to differentiate. I did not test the @Required annotation when it is placed at the Class/file level, as I wasn't sure that was in scope and also since I opened #1343 as a possible change to using the same annotation for those two purposes.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 1, 2023

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 6, 2023

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

@isabelle-dr
Copy link
Copy Markdown
Contributor

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).
I don't think it necessarily interacts with the work in this PR, just something to keep in mind.

Merging this PR, thank you @briandonahue!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 6, 2023

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

@isabelle-dr
Copy link
Copy Markdown
Contributor

@briandonahue could you resolve the conflicts? :)

@briandonahue
Copy link
Copy Markdown
Contributor Author

@briandonahue could you resolve the conflicts? :)

@isabelle-dr done!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 9, 2023

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

@isabelle-dr
Copy link
Copy Markdown
Contributor

Thank you for this awesome contribution @briandonahue! ✨

@isabelle-dr isabelle-dr merged commit 9bde7a1 into master Mar 10, 2023
@isabelle-dr isabelle-dr deleted the issue/1198/required_field_transfer_type branch March 10, 2023 16:11
ryon pushed a commit to JarvusInnovations/gtfs-validator that referenced this pull request Apr 1, 2023
…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]>
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.

False positives of missing_required_field when encountering empty transfer_type values in transfers.txt

3 participants