-
Notifications
You must be signed in to change notification settings - Fork 120
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
Add fromJson to all API response models #606
Comments
I like it. If I understand it correctly, this would bring functionality consistent with what we already provide for other types like GeoJSON (https://github.com/mapbox/mapbox-java/blob/master/mapbox/libjava-geojson/src/main/java/com/mapbox/services/commons/geojson/Feature.java#L130-L142). Correct? |
Exactly, this is inspired by the trouble I ran into when debugging this. AutoValue Gson type adapter factory documentation for reference. |
Is this still in progress? |
This would be great. |
This landed for directions models with #854. @jethro-2018 could you share a bit more about your use case (service, serialization needed, ...)? Thanks! |
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
Now that we are using AutoValue, the response objects which get created during the serialization of JSON require a type adapter factory which can often be confusing in times when you want to deserialize a JSON string into a DirectionsResponse for example. Doing so without adding the type adapter factory will result in:
To make this easier, I'm proposing we add a static factory method to all API model classes which would looks something like:
cc: @zugaldia
The text was updated successfully, but these errors were encountered: