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

Add rental system to GraphQL API #5909

Merged
merged 21 commits into from
Jul 8, 2024

Conversation

sharhio
Copy link
Contributor

@sharhio sharhio commented Jun 14, 2024

Summary

  1. RentalVehicleSystem is returned for rental vehicles. This is so that a the system url to an operator can be provided (especially when there is no vehicle specific link available.)
  2. Searching for nearest stations/vehicles can be filtered by networks. In some cases we only want to show the stations/vehicles of certain operators, and without filtering, the nearest search returns a very large amount of unnecessary data. The large amount of unwanted data coupled with a result limit makes most of the results unusable.
  3. Added an option for hiding networks from maplayers so that unnecessary data doesn't always need to be returned from otp. (For example, in cases where one only wants to show the vehicles of a network and never the stations.)
  4. Sometimes data is faulty and the name field contains an empty string, this causes an error in the FeedScopedId. Added an empty string check.

Unit tests

  • Added new parameters to unit tests.
  • Manual verification was done.

@sharhio sharhio requested a review from a team as a code owner June 14, 2024 07:51
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

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

Project coverage is 69.51%. Comparing base (2a5c8be) to head (87bda74).
Report is 38 commits behind head on dev-2.x.

Files Patch % Lines
...ntripplanner/apis/gtfs/generated/GraphQLTypes.java 50.00% 2 Missing ⚠️
...e_rental/datasources/GbfsGeofencingZoneMapper.java 0.00% 1 Missing and 1 partial ⚠️
...anner/apis/transmodel/TransmodelGraphQLSchema.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #5909      +/-   ##
=============================================
+ Coverage      69.45%   69.51%   +0.05%     
- Complexity     17070    17104      +34     
=============================================
  Files           1937     1938       +1     
  Lines          73692    73743      +51     
  Branches        7540     7547       +7     
=============================================
+ Hits           51184    51263      +79     
+ Misses         19880    19841      -39     
- Partials        2628     2639      +11     

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

Copy link
Member

@optionsome optionsome left a comment

Choose a reason for hiding this comment

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

I'm not really sure if we should have the network filtering in the map layer or just do it in UI. The problem is that even though we might not want to show some networks in our UI, some other people might. On the other hand, setting this filter on a request level is not really feasible with the map layers. There is an option that we expose filtered and unfiltered versions of the map layer but there is some push towards unifying the map layers and this would be slightly away from it by adding yet another map layer that is only used by us.

@leonardehrenfried leonardehrenfried self-requested a review June 18, 2024 09:04
@@ -61,6 +62,11 @@ public DataFetcher<RentalVehicleType> vehicleType() {
return environment -> getSource(environment).vehicleType;
}

@Override
Copy link
Member

Choose a reason for hiding this comment

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

We don't want to expose core model classes directly in the API. Can you please add an Impl (=mapper) class just like RentalVehicleImpl?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added a mapper.

Copy link
Member

@leonardehrenfried leonardehrenfried left a comment

Choose a reason for hiding this comment

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

I want to see tests and the mapper class.

…ources/GbfsGeofencingZoneMapper.java

Co-authored-by: Leonard Ehrenfried <mail@leonard.io>
@leonardehrenfried leonardehrenfried changed the title Rental vehicle result and maplayer adjustments Add rental system to GraphQL API Jun 19, 2024
@@ -1746,6 +1748,8 @@ type RentalVehicle implements Node & PlaceInterface {
rentalUris: VehicleRentalUris
"ID of the vehicle in the format of network:id"
vehicleId: String
"The vehicle rental system information."
vehicleRentalSystem: VehicleRentalSystem
Copy link
Member

Choose a reason for hiding this comment

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

We need to discuss in the developer meeting what to do with the naming of this field/type and if it's already too late to create a type for this.

@optionsome
Copy link
Member

This is now ready for review.

@@ -1183,6 +1183,8 @@ type QueryType {
nearest places related to bicycling.
"""
filterByModes: [Mode],
"Only include vehicle rental networks that match one of the given network names."
Copy link
Member

Choose a reason for hiding this comment

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

I think the term "network name" is confusing here. Is it the network id?

Copy link
Member

Choose a reason for hiding this comment

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

While updating it, I noticed we could also make the list items non null so I did it in the same commit 87bda74

Copy link
Member

@leonardehrenfried leonardehrenfried left a comment

Choose a reason for hiding this comment

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

Just a bit of documentation.

@optionsome
Copy link
Member

I've approved this now to get rid of my old review but I'll wait for @vpaturet 's review before merging.

Copy link
Contributor

@vpaturet vpaturet left a comment

Choose a reason for hiding this comment

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

This looks good

@optionsome optionsome merged commit e508838 into opentripplanner:dev-2.x Jul 8, 2024
5 checks passed
@optionsome optionsome deleted the rentalvehicle-details branch July 8, 2024 18:57
t2gran pushed a commit that referenced this pull request Jul 8, 2024
@t2gran t2gran added this to the 2.6 (next release) milestone Jul 23, 2024
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.

5 participants