Improve handling of null values in argument lists to the serviceJourneys graphQL method in the Transmodel API #6375
+18
−3
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.
Summary
This ignores null members in lists of arguments. Today this fails with NullPointerExceptions deeper in the stack, which is difficult for users to interpret.
Tested with local runs.
Current error message:
Exception while fetching data (/serviceJourneys) : Cannot invoke \"Object.equals(Object)\" because \"this.value\" is null
New behavior is to just ignore the null in an argument set to: [null].
To recreate current error: https://api.entur.io/graphql-explorer/journey-planner-v3?query=query%20GetDepartureStops%28%24authorities%3A%5BString%5D%24privateCodes%3A%5BString%5D%24dateYesterday%3ADate%24date%3ADate%29%7BserviceJourneys%28authorities%3A%24authorities%20privateCodes%3A%24privateCodes%20activeDates%3A%5B%24dateYesterday%24date%5D%29%7Bid%20stopsYesterday%3AestimatedCalls%28date%3A%24dateYesterday%29%7Bquay%7Bname%7Ddate%20aimedDepartureTime%20expectedDepartureTime%20expectedArrivalTime%20forAlighting%7DstopsToday%3AestimatedCalls%28date%3A%24date%29%7Bquay%7Bname%7Ddate%20aimedDepartureTime%20expectedDepartureTime%20expectedArrivalTime%20forAlighting%7D%7D%7D&variables=%7B%0A%20%20%22authorities%22%3A%20%5B%0A%20%20%20%20%22VYG%3AAuthority%3AVYT%22%2C%0A%20%20%20%20%22VYG%3AAuthority%3AVY%22%2C%0A%20%20%20%20%22GJB%3AAuthority%3AGJB%22%2C%0A%20%20%20%20%22NSB%3AAuthority%3ANSB%22%2C%0A%20%20%20%20%22SJN%3AAuthority%3ASJN%22%2C%0A%20%20%20%20%22GOA%3AAuthority%3AGOA%22%2C%0A%20%20%20%20%22FLT%3AAuthority%3AFLT%22%0A%20%20%5D%2C%0A%20%20%22privateCodes%22%3A%20%5Bnull%5D%2C%0A%20%20%22dateYesterday%22%3A%20%222025-01-04%22%2C%0A%20%20%22date%22%3A%20%222025-01-05%22%0A%7D