Skip to content

Make estimated calls non nullable in the TransModel API - #6526

Merged
t2gran merged 1 commit into
opentripplanner:dev-2.xfrom
entur:make_estimated_calls_non_null
Mar 14, 2025
Merged

t2gran merged 1 commit into
opentripplanner:dev-2.xfrom
entur:make_estimated_calls_non_null

Conversation

@vpaturet

@vpaturet vpaturet commented Mar 10, 2025 •

Copy link
Copy Markdown
Contributor

Summary

As a consequence of #6245, the TransModel API can return null for the list of estimatedCalls of a given ServiceJourney or DatedServiceJourney, if the trip does not run on the given date. Before this change, the API would return an empty list [].

This is not consistent with the rest of the API: On quays and stopPlaces, estimatedCalls are expected to be non-null. The same applies for serviceJourneyEstimatedCalls and intermediateEstimatedCalls in other parts of the API.

This PR:

  • reverts to the original behavior where the API returns an empty list instead of null.
  • aligns the behavior of estimatedCalls on ServiceJourney and DatedServiceJourney with the rest of the API, by making them explicitly non-nullable: [EstimatedCall!]!

Note: while making a nullable input type non-nullable is a breaking change, making a nullable output type non-nullable does not break compatibility for API clients.

Issue

No.

Unit tests

No. The change is made in the GraphQL layer where we have little support for unit testing.

Documentation

No

@vpaturet
vpaturet marked this pull request as ready for review March 11, 2025 08:09
@vpaturet
vpaturet requested a review from a team as a code owner March 11, 2025 08:09
@vpaturet vpaturet changed the title Make estimated calls non nullable in the TranModel API Make estimated calls non nullable in the TransModel API Mar 11, 2025
@vpaturet
vpaturet force-pushed the make_estimated_calls_non_null branch from 06e3f76 to 92b3bfa Compare March 11, 2025 08:12
@codecov

codecov Bot commented Mar 11, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 70.18%. Comparing base (6fd4d48) to head (92b3bfa).
Report is 53 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...model/model/timetable/DatedServiceJourneyType.java 50.00% 1 Missing ⚠️
...transmodel/model/timetable/ServiceJourneyType.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6526      +/-   ##
=============================================
+ Coverage      70.17%   70.18%   +0.01%     
- Complexity     18310    18316       +6     
=============================================
  Files           2082     2082              
  Lines          77217    77217              
  Branches        7832     7832              
=============================================
+ Hits           54185    54193       +8     
+ Misses         20259    20256       -3     
+ Partials        2773     2768       -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.

@vpaturet vpaturet added the Entur Test This is currently being tested at Entur label Mar 11, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it makes sense to disallow null in these cases, and use empty list as the default value.

@t2gran t2gran added this to the 2.8 (next release) milestone Mar 12, 2025
@t2gran
t2gran merged commit 02bc4b7 into opentripplanner:dev-2.x Mar 14, 2025
@t2gran
t2gran deleted the make_estimated_calls_non_null branch March 14, 2025 12:01
t2gran pushed a commit that referenced this pull request Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Entur Test This is currently being tested at Entur

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants