Not able to parse response for optimization or direction API for .geometries("geojson")
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start with samples/src/main/java/com/mapbox/samples/BasicDirections.java and BasicOptimization.java, reproduce the failure using geometries("geojson"), and inspect the response at trips[0].geometry. Compare the object returned for GeoJSON with the string returned for polyline6; done means both Directions and Optimization responses parse without the Gson exception.
Written by the indexing model from the issue text.
Description
if I add .geometries("geojson") as routeOption in
https://github.com/mapbox/mapbox-java/blob/main/samples/src/main/java/com/mapbox/samples/BasicDirections.java
or
https://github.com/mapbox/mapbox-java/blob/main/samples/src/main/java/com/mapbox/samples/BasicOptimization.java
It throws an error
Expected a string but was BEGIN_OBJECT at line 1 column 412 path $.trips[0].geometry
Where as it works when we call via API playground or use polyline6 as geometry.
Caused by: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 412 path $.trips[0].geometry
at com.google.gson.stream.JsonReader.nextString(JsonReader.java:824) ~[gson-2.8.9.jar:na]
at com.google.gson.internal.bind.TypeAdapters$15.read(TypeAdapters.java:380) ~[gson-2.8.9.jar:na]
at com.google.gson.internal.bind.TypeAdapters$15.read(TypeAdapters.java:368) ~[gson-2.8.9.jar:na]
at com.mapbox.api.directions.v5.models.AutoValue_DirectionsRoute$GsonTypeAdapter.read(AutoValue_DirectionsRoute.java:223) ~[mapbox-sdk-directions-models-6.3.0.jar:na]
at com.mapbox.api.directions.v5.models.AutoValue_DirectionsRoute$GsonTypeAdapter.read(AutoValue_DirectionsRoute.java:31) ~[mapbox-sdk-directions-models-6.3.0.jar:na]
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41) ~[gson-2.8.9.jar:na]
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82) ~[gson-2.8.9.jar:na]
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61) ~[gson-2.8.9.jar:na]
at com.mapbox.api.optimization.v1.models.AutoValue_OptimizationResponse$GsonTypeAdapter.read(AutoValue_OptimizationResponse.java:115) ~[mapbox-sdk-services-6.3.0.jar:na]
at com.mapbox.api.optimization.v1.models.AutoValue_OptimizationResponse$GsonTypeAdapter.read(AutoValue_OptimizationResponse.java:28) ~[mapbox-sdk-services-6.3.0.jar:na]
I am using mapbox-sdk-core-6.3.0.jar
- Dominant language
- Java
- Stars
- 438
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mapbox/mapbox-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mapbox/mapbox-java#1640 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
mapbox/mapbox-java#1635 ·
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
mapbox/mapbox-java#1619 ·
-
Mapbox-java incompatible with gson 2.13.0 and up - call to internal GSON classes that were renamed Open
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
mapbox/mapbox-java#1614 · 2 comments · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
mapbox/mapbox-java#1612 · 1 reaction ·
All issues in mapbox/mapbox-java
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Two open-case totals on one screen: the Programs tile says 15,858 and the nav badge says 15,868 Openbug frontend maui-pilot
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
objectionary/eo-graphs#74 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100