I am working on the graphql api to fetch the data. Apollo SDK auto generates the models against the graphql query and get the response for us.
Is there any way we can define our custom response model to the query? except apollo uses autogenerated model for the query. I go through to documentation but didn’t get any useful information there.
Hi ! Apollo Android indeed generates typesafe models from your queries. That’s one of the main features as it removes the need to do that manually and also makes sure that only the fields that are queried are actually readable from your UI.
If you have your own UI models, we usually recommend that you map from the generated models to your UI models so that the network layer is decoupled from the UI layer. It’s some boilerplate code to write but there’s no silver bullet unfortunately.
Hope this helps. Let me know if you were looking into something different or have any other feature in mind!