I use the Apollo Android library to make queries to a GraphQL endpoint. Everything works OK until I try to convert the results back to JSON strings (to store them in a Room database). I naively tried to use Moshi, however this fails with the following error:
Cannot get available extra products: No JsonAdapter for interface com.example.MyQuery$MyFragmentInterface
where MyFragmentInterface
in an interface generated by Apollo to handle query fragments.
So, I tried to find whether the Apollo library has/generates any conversion methods, i.e. sth like toJson()
/fromJson()
, for the generated models, however I couldn't find anything usable.
Am I missing something obvious?
from How does one manually convert Apollo Android-generated objects into JSON strings and back?
No comments:
Post a Comment