Vehicle rental updates#3632
Conversation
|
I have looked at the core changes and those looks ok, so feel free to merge this when it is ready. We will update the Transmodel API after this get merged. |
|
This looks good. I have a questions: does upgrading the codegen libs solve the problem of manually having to fix the enum code? |
Yes, that was fixed in a recent version of the plugin |
|
We discussed this on tuesday's meeting and decided that it's better if we split the floating vehicles into own query type in the GraphQL APIs. I'll do that for the legacy GraphQL API in the scope of this pr. |
Noticed today that there are still some issues with enum type arguments that to my knowledge require editing the LegacyGraphQLTypes.java file manually. For example for the routes query arguments, the following code gets now generated: which needs to be edited to |
optionsome
left a comment
There was a problem hiding this comment.
There is still only possible to filter by ids using "bikeRentalStations" in the nearest query. This could be changed but I'm not sure how often this functionality is even used. Also it would be nice if it was possible to filter nearest query so you would only get vehicles or stations.
|
|
||
| if (args.getLegacyGraphQLIds() != null) { | ||
| ArrayListMultimap<String, VehicleRentalStation> vehicleRentalStations = | ||
| vehicleRentalStationService.getVehicleRentalStations() |
There was a problem hiding this comment.
Should there be a helper method for getting only vehicles/stations in VehicleRentalStationService and/or should we store the vehicles and the stations in separate Maps there?
There was a problem hiding this comment.
I think a helper method would suffice
| id: ID! | ||
|
|
||
| """ID of the vehicle in the format of network:id""" | ||
| vehicleId: String |
There was a problem hiding this comment.
Should this id have a more generic term that could be shared between RentalVehicle and VehicleRentalStation?
hannesj
left a comment
There was a problem hiding this comment.
Looks good for the common code, minor comments for the sandbox.
|
|
||
| if (args.getLegacyGraphQLIds() != null) { | ||
| ArrayListMultimap<String, VehicleRentalStation> vehicleRentalStations = | ||
| vehicleRentalStationService.getVehicleRentalStations() |
There was a problem hiding this comment.
I think a helper method would suffice
| SelectionSet set = environment.getField().getFields().get(0).getSelectionSet(); | ||
| boolean queryHasBikeRentalStationFragment = set != null && set.getSelections() | ||
| .stream() | ||
| .filter(selection -> selection instanceof InlineFragment) |
There was a problem hiding this comment.
What about FragmentDefinition?
There was a problem hiding this comment.
Seems like we can only see the name of a FragmentDefinition from TypeResolutionEnvironment. So currently, we can't add support for deciding which object type to return based on those types of fragments so we will always return VehicleRentalStation. This breaks backwards compatibility a bit but we only use inline fragments for the nearest query in our UI so it's ok to have this problem for a while. I created an issue in graphql-java project about adding more information about fragments to the environment so this can be fixed later.
|
On Tuesday's discussion, we decided to evaluate if https://github.com/kobylynskyi/graphql-java-codegen could be used to replace the code generation based on the GraphQL schema but I won't do it in the scope of this pull request. I think this pull request is now ready for final review. |
| VehicleRentalStationService service = graph.getVehicleRentalStationService(); | ||
| if (service == null) {return List.of();} | ||
| return service.getVehicleRentalStations() | ||
| return service.getVehicleRentalPlaces() |
There was a problem hiding this comment.
We should probably split this layer in two, so that they can be showed on different zoom levels. This can be done later
| public ZonedDateTime lastReported; | ||
|
|
||
| // OTP internal data | ||
| public boolean allowOverloading = false; |
There was a problem hiding this comment.
There is some javadoc in the VehicleRentalPlace for it. All fields here seem to be missing javadoc. There's currently no mention anywhere that this information is not in the GBFS spec but I'm not sure what would be the approriate place for it.
There was a problem hiding this comment.
You could just link to the VehicleRentalPlace in the class JavaDoc then. I try to avoid redundant documentation:
/** See {link VehicleRentalPlace} ... */
There was a problem hiding this comment.
Should that be done for this field and/or whole class and/or all fields/methods?
There was a problem hiding this comment.
I added a couple of comments that link the implementing classes to the interface class.
Summary
Issue
closes #3631
Unit tests
Updated tests
Code style
Have you followed the suggested code style?
Yes
Documentation
Changelog
TODO