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

Routable points support for services-geocoding #1522

Merged
merged 1 commit into from
Dec 1, 2022

Conversation

DzmitryFomchyn
Copy link
Contributor

Add routable points support for services-geocoding

@DzmitryFomchyn DzmitryFomchyn requested a review from a team as a code owner December 1, 2022 20:28
@DzmitryFomchyn DzmitryFomchyn force-pushed the df-routable-points branch 2 times, most recently from 40164e6 to c94cffc Compare December 1, 2022 20:42
@codecov
Copy link

codecov bot commented Dec 1, 2022

Codecov Report

Merging #1522 (1ae380d) into main (d112384) will increase coverage by 0.01%.
The diff coverage is 83.33%.

❗ Current head 1ae380d differs from pull request most recent head a9cdf39. Consider uploading reports for the commit a9cdf39 to get more accurate results

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ
.../mapbox/api/geocoding/v5/models/CarmenContext.java 33.33% <ø> (ø)
.../mapbox/api/geocoding/v5/models/CarmenFeature.java 82.14% <ø> (ø)
.../mapbox/api/geocoding/v5/models/RoutablePoint.java 71.42% <71.42%> (ø)
...a/com/mapbox/api/geocoding/v5/MapboxGeocoding.java 85.84% <100.00%> (+0.12%) ⬆️
...mapbox/api/geocoding/v5/models/RoutablePoints.java 100.00% <100.00%> (ø)

Copy link
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

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

Left some comments.

* @return routable point name
* @since 6.10.0
*/
@Nullable
Copy link
Contributor

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?

Copy link

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Member

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.

Copy link

@kalbaxa kalbaxa left a 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.

@Guardiola31337
Copy link
Contributor

Discussed internally, let's ship as is as services-geocoding is going to be deprecated soon.

cc @DzmitryFomchyn @kalbaxa

@DzmitryFomchyn DzmitryFomchyn merged commit c7a13df into main Dec 1, 2022
@DzmitryFomchyn DzmitryFomchyn deleted the df-routable-points branch December 1, 2022 22:19
tomaszrybakiewicz added a commit that referenced this pull request Dec 2, 2022
tomaszrybakiewicz added a commit that referenced this pull request Dec 2, 2022
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.

None yet

5 participants