-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Open
eibakke
wants to merge
5
commits into
opentripplanner:dev-2.x
Choose a base branch
from
entur:better_sj_api
base: dev-2.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3a60232
Requires at least one of the arguments to the serviceJourneys API end…
eibakke 00e4dc4
Filters out empty strings for the privateCodes field in the serviceJo…
eibakke 36fec83
Adds details to error message and documentation of serviceJourneys API.
eibakke 45193a1
Update application/src/main/java/org/opentripplanner/apis/transmodel/…
eibakke 3a04547
Adds nullable to return value of toStringList.
eibakke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.