Skip to content

Change the TripRequest and builder to work with include lists instead of just the FilterValues #6525

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

Merged
merged 3 commits into from
Mar 17, 2025

Conversation

eibakke
Copy link
Contributor

@eibakke eibakke commented Mar 10, 2025

Summary

This PR changes the behaviour of the ServiceJourneys Transmodel API endpoint so that null or unset values match everything, but empty lists match nothing.

This is different from today's production where arguments set to empty lists match everything, just like null or unset values. For example: https://api.entur.io/graphql-explorer/journey-planner-v3?query=%7BserviceJourneys%28authorities%3Anull%29%7Bid%7D%7D

Today's behaviour where everything is returned causes errors:
image

While the new behaviour causes empty lists to be returned (because nothing is matched):
image

Behaviour for null or unset arguments is the same (error because of too many results).

Issue

#5630

Unit tests

Tested with unit tests on the matcher resulting from the TripMatcherFactory, and by running locally.

…d of just the FilterValues.

Also introduces a NullIsEverything FilterValues which better encapsulates the logic of an include collection (which is that an empty should match nothing, but a null should match everything).
@eibakke eibakke requested a review from a team as a code owner March 10, 2025 14:09
Copy link

codecov bot commented Mar 10, 2025

Codecov Report

Attention: Patch coverage is 70.58824% with 10 lines in your changes missing coverage. Please review.

Project coverage is 70.25%. Comparing base (94950f1) to head (a80c70b).
Report is 97 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...anner/apis/transmodel/TransmodelGraphQLSchema.java 0.00% 5 Missing ⚠️
...anner/apis/transmodel/mapping/TransitIdMapper.java 0.00% 3 Missing ⚠️
...entripplanner/apis/transmodel/support/GqlUtil.java 0.00% 1 Missing ⚠️
...lanner/transit/api/request/TripRequestBuilder.java 88.88% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6525      +/-   ##
=============================================
+ Coverage      70.17%   70.25%   +0.07%     
- Complexity     18312    18373      +61     
=============================================
  Files           2082     2088       +6     
  Lines          77214    77377     +163     
  Branches        7831     7839       +8     
=============================================
+ Hits           54188    54358     +170     
+ Misses         20256    20244      -12     
- Partials        2770     2775       +5     

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@t2gran t2gran added this to the 2.8 (next release) milestone Mar 12, 2025
t2gran
t2gran previously approved these changes Mar 13, 2025
Copy link
Member

@t2gran t2gran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that there is no unit-test on the FilterValues and FilterValuesNullsEverything - this is ok as long as the TripMatcherFactoryTest cover all cases. Is this the case?

@eibakke eibakke dismissed stale reviews from leonardehrenfried and t2gran via 89198dd March 17, 2025 11:43
@leonardehrenfried leonardehrenfried merged commit 85dbd83 into opentripplanner:dev-2.x Mar 17, 2025
6 checks passed
t2gran pushed a commit that referenced this pull request Mar 17, 2025
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.

3 participants