-
Notifications
You must be signed in to change notification settings - Fork 121
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
Routable points support for services-geocoding #1522
Conversation
40164e6
to
c94cffc
Compare
Codecov Report
@@ Coverage Diff @@
## main #1522 +/- ##
============================================
+ Coverage 77.25% 77.26% +0.01%
- Complexity 952 957 +5
============================================
Files 130 132 +2
Lines 4080 4091 +11
Branches 587 588 +1
============================================
+ Hits 3152 3161 +9
- Misses 678 679 +1
- Partials 250 251 +1
|
c94cffc
to
33d3c6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments.
services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/MapboxGeocoding.java
Outdated
Show resolved
Hide resolved
services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/models/CarmenFeature.java
Outdated
Show resolved
Hide resolved
services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/models/CarmenFeature.java
Outdated
Show resolved
Hide resolved
services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/models/RoutablePoint.java
Outdated
Show resolved
Hide resolved
services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/models/RoutablePoint.java
Outdated
Show resolved
Hide resolved
* @return routable point name | ||
* @since 6.10.0 | ||
*/ | ||
@Nullable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really nullable? I mean, what I'd expect is RoutablePoints
to be nullable but If they're not, any RoutablePoint
from the list to have valid values. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Guardiola31337 Do you mean by duplicating e.g. the rooftop location in RoutablePoints
? If yes, I disagree.
I assume the correct distinction would be to leave RoutablePoints
null if there are none and let the app logic decide how to behave in that case (e.g. fallback to original location). Otherwise it's becoming ambiguous whether the data is actually available for the specific search result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Guardiola31337 in addition to what @kalbaxa said, I think it's better to leave it as nullable because all the service-geocoder
relies on AutoValue/GSON
serialisation/deserialisation. If we declare any field as non-nullable and for some reason backend don't send the value, the SDK will crash. I don't want this. I think it's better to check for null on customer's side and use alternative fallback. Also, nullable fields are consistent with the current approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kalbaxa What I meant was that routable points could be null
(that's totally fine) but if the server emits a routable point, I would expect not to be null
(having null
fields), that's the contract I'd expect from the backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DzmitryFomchyn IMO errors in the backend should fail-fast, this approach would hide this type of issues as they'd go unnoticed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A can agree with that, but we should also be consistent here. All the current code relies on nullability, it won't make any better if we make one field as non-null while everything else remain nullable. Given everything that's written above, I think we should leave as is now and discuss another approach in case of SDK refactoring, if it happen. More likely, service-geocoder
will be deprecated soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we declare any field as non-nullable and for some reason backend don't send the value, the SDK will crash. I don't want this.
+++
Event if it's not an error on the backend side, it can be a logic change. For example, we accidentally made waypoints nullable but that played well because after some time they did become nullable because a case was introduced that they can be returned in a different response level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it can be a logic change
A logic change like this should mean a major version upgrade of an endpoint. All customers (not only Nav SDK) would be impacted by such an intentional change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily. With waypoints they wouldn't (and weren't). Because it depends on a new request parameter which falls back to old behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would have to provide backwards compatibility if that wasn't the case (either on backend or mapbox-java level). We were lucky and needed less work for that specific situation but that shouldn't be the reason to make contracts less strict going forward.
services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/models/RoutablePoint.java
Show resolved
Hide resolved
services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/models/RoutablePoint.java
Show resolved
Hide resolved
services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/models/RoutablePoint.java
Show resolved
Hide resolved
services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/models/RoutablePoint.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we align with @DzmitryFomchyn and @Guardiola31337 on the routable points approach, I'm good with the merge.
1ae380d
to
a9cdf39
Compare
Discussed internally, let's ship as is as |
Add routable points support for
services-geocoding