Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add validation to the serviceJourney Transmodel API endpoint #6559
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
base: dev-2.x
Are you sure you want to change the base?
Add validation to the serviceJourney Transmodel API endpoint #6559
Changes from 2 commits
3a60232
00e4dc4
36fec83
45193a1
3a04547
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I think in general it's best to be strict and not have special handling for empty strings and other edge cases. Cleaning user data hides bugs in the clients where they should be fixed.
If a user says they want the service journeys with private codes
[ "" ]
then they should get the service journeys that has that private code, which will most probably be an empty set.What do you think about that?
The null filtering is fine though, we probably need this since we for some reason allowed the elements to be null.
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.
This is the opposite of what @vpaturet expressed in #6545 (comment)
I tend to agree with Vincent here, that empty strings should be ignored ie. treated the same as nulls. This also matches how the mapIDsToDomain method handles empty (or even blank strings), using
OpenTripPlanner/utils/src/main/java/org/opentripplanner/utils/lang/StringUtils.java
Line 25 in e8e9a77
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 the slow response here!
I must say that I disagree with treating empty strings as nulls. If we need to do it for backwards compatability I can see the point, but in this case it looks like we are making the api less strict than previously. The stricter we make the api and the less special cases we add the easier it will be to maintain.
We had a short discussion around this on the developer meeting two weeks ago, and I think the consensus was to avoid special handling for empty strings unless it's needed for compatability reasons.