Skip to content
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

Improve handling of null values in argument lists to the serviceJourneys graphQL method in the Transmodel API #6375

Open
wants to merge 2 commits into
base: dev-2.x
Choose a base branch
from

Conversation

eibakke
Copy link
Contributor

@eibakke eibakke commented Jan 10, 2025

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

@eibakke eibakke requested a review from a team as a code owner January 10, 2025 12:14
@eibakke eibakke requested a review from vpaturet January 10, 2025 12:14
Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Project coverage is 69.80%. Comparing base (025e4c4) to head (4b2cb11).
Report is 6 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...entripplanner/apis/transmodel/support/GqlUtil.java 0.00% 3 Missing ⚠️
...anner/apis/transmodel/TransmodelGraphQLSchema.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6375      +/-   ##
=============================================
- Coverage      69.80%   69.80%   -0.01%     
+ Complexity     17943    17941       -2     
=============================================
  Files           2046     2046              
  Lines          76671    76674       +3     
  Branches        7830     7830              
=============================================
- Hits           53521    53520       -1     
- Misses         20408    20411       +3     
- Partials        2742     2743       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…eJourneys GraphQL method.

With this change the null members are simply ignored, just like when passing null members to the ID list.
@eibakke eibakke changed the title Improve validation and error messages of input arguments to the serviceJourneys graphQL method in the Transmodel API Improve handling of null values in argument lists to the serviceJourneys graphQL method in the Transmodel API Jan 10, 2025
@eibakke eibakke requested a review from t2gran January 13, 2025 08:47
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.

2 participants