Repository navigation
Add available types and spaces to VehicleRentalStation - #5425
optionsome merged 3 commits into
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5425 +/- ##
=============================================
+ Coverage 66.67% 66.87% +0.19%
- Complexity 15396 15495 +99
=============================================
Files 1794 1800 +6
Lines 69682 69793 +111
Branches 7345 7353 +8
=============================================
+ Hits 46461 46672 +211
+ Misses 20757 20662 -95
+ Partials 2464 2459 -5
☔ View full report in Codecov by Sentry. |
leonardehrenfried
left a comment
There was a problem hiding this comment.
For a very first PR this is a really good job!
I've left a few comments about things that I'd like you to change.
The failing test will be fixed if you add a mapping for VehicleTypeCount in the codegen config:
We will be doing some thinking over the next few days if the want to keep the API schema or will ask you to change it.
| @@ -0,0 +1,37 @@ | |||
| { | |||
There was a problem hiding this comment.
Well done for finding out how to use these tests.
There was a problem hiding this comment.
We are now adding tests for this in two different prs, since this is a more complete version, lets try to get this merged first and I'll update #5411 afterwards.
| """ | ||
| Number of vehicles currently available on the rental station, grouped by vehicle type. | ||
| """ | ||
| vehicleTypesAvailable: [RentalVehicleTypeCount!] | ||
|
|
||
| """ | ||
| Number of free spaces currently available on the rental station, grouped by vehicle type. | ||
| """ | ||
| vehicleSpacesAvailable: [RentalVehicleTypeCount!] | ||
|
|
There was a problem hiding this comment.
I think this is a good way of expressing the information but we will discuss this in one of our meeting if we can do better. (We leave ourselves lots of time to think about API schemas because once they are released it's almost impossible to change them later.)
|
Also please merge or rebase onto dev-2.x so I can get an accurate view of the code coverage. |
b356df7 to
cc4f2f3
Compare
| public List<RentalVehicleTypeCount> getVehicleTypeCounts() { | ||
| return vehicleRentalTypeMapToList(vehicleTypesAvailable); | ||
| } | ||
|
|
||
| public List<RentalVehicleTypeCount> getVehicleSpaceCounts() { | ||
| return vehicleRentalTypeMapToList(vehicleSpacesAvailable); | ||
| } |
There was a problem hiding this comment.
This file is not a good example but we would like to see Javadoc for all public methods.
| vehicleTypesAvailable: [RentalVehicleTypeCount!] | ||
|
|
||
| """ | ||
| Number of free spaces currently available on the rental station, grouped by vehicle type. | ||
| """ | ||
| vehicleSpacesAvailable: [RentalVehicleTypeCount!] |
There was a problem hiding this comment.
Just thinking out aloud: whenever I read a repeated word in the schema I wonder if these two properties should be grouped together. Perhaps something like this:
availability {
types: VehicleTypeCount
spaces: VehicleTypeCount
}
(Please don't do anything yet, @cedarbaum, as this thought is not fully formed yet. We will discuss in a dev meeting.)
There was a problem hiding this comment.
@optionsome and I had a chat what we want the schema to look like and we have landed on the following (pseudo-graphqls language):
availableVehicles {
total: Int
byType: [VehicleTypeCount!]!
}
availableSpaces {
total: Int
byType: [VehicleTypeCount!]!
}
We also want to deprecate the spacesAvailable and vehiclesAvailable fields so it's not too confusing for the consumers.
Does this make sense, @cedarbaum ?
There was a problem hiding this comment.
This makes sense, I went ahead and updated the PR with the new query structure. I did keep the Rental prefix for the GraphQL types to be consistent with other existing types, but let me know if you have a preference for these type names (RentalVehicleEntityCounts and RentalVehicleTypeCount, specifically).
I also noticed that @t2gran proposed an alternative query structure. Is there consensus with the maintainers about the final design or is it still being discussed? If it's still being discussed and it would be helpful for me to attend a future dev meeting, I am happy to do so!
There was a problem hiding this comment.
Well I thought there was a consensus until there wasn't. :)
We will definitely discuss this again today at our meeting at 3pm CET. Everybody is welcome to attend but it will not be required to get this merged.
There was a problem hiding this comment.
I am fine with the suggestion made by @optionsome and @leonardehrenfried.
cc4f2f3 to
859b168
Compare
vehicleTypesAvailable and vehicleSpacesAvailable to VehicleRentalStationvehicleTypesAvailable and vehicleSpacesAvailable to VehicleRentalStation
vehicleTypesAvailable and vehicleSpacesAvailable to VehicleRentalStationVehicleRentalStation
859b168 to
89a6b14
Compare
|
Quick update, @cedarbaum: There was a bit of miscommunication between @optionsome, I and @t2gran as the latter hadn't realised that we made a proposal for the schema. He's going to take another look at what we suggested and will let us know if he agrees or not. |
|
I will leave the final review to @leonardehrenfried and @optionsome. Thank you for contributing. |
leonardehrenfried
left a comment
There was a problem hiding this comment.
I've taken the liberty to apply a few cosmetic changes directly. I hope this is ok.
Thanks for the contribution!
|
|
||
| type RentalVehicleEntityCounts { | ||
| """The total number of entities (e.g. vehicles, spaces).""" | ||
| total: Int! |
There was a problem hiding this comment.
I think this should be nullable because I know there are rental operators who are incapable of reporting realtime status of available vehicles/spaces for the stations. We can discuss this in the developer meeting today @leonardehrenfried. Alternatively, the available spaces/vehicles fields could be nullable.
There was a problem hiding this comment.
In GBFS they are mandatory. Are you thinking of your own custom importer for Vilkuu?
There was a problem hiding this comment.
I'm not sure about this. The 2.3 documentation says for num_docks_available "REQUIRED except for stations that have unlimited docking capacity (for example, valet stations) ". We got rid of the Vilkku updater as they now provide gbfs but it still has similar problems and it can't be the only network in the world where they are not able to provide real numbers for everything.
There was a problem hiding this comment.
Ok, lets have a chat on the call today.

Summary
This PR adds
vehicleTypesAvailableandvehicleSpacesAvailableto theVehicleRentalStationtype. These fields return the count of each vehicle type available for pickup and drop-off, respectively. As an example, this is what the new fields look like in thevehicleRentalStationquery:Issue
N/A
Unit tests
vehicleRentalStationquery with the new fieldsDocumentation