https://kotlinlang.org logo
#graphql-kotlin
Title
# graphql-kotlin
a

am414

01/17/2021, 10:18 AM
hello everyone for android users I'm starting to use Apollo (instead of Retrofit )to make requests from graphql Api, I'm new to this style so i have some questions if someone experienced this before  i already made the first call, and i realised that the data model generated at compile time and its not open to modify or extend it, how i can modify it, for example i need to make data model for Room database and that model is the same model of the model i will get from the api so what i have to do in this situation ? any help please
m

mbonnin

01/17/2021, 10:58 AM
Hi @am414 👋 #apollo-android will be better suited for this question. That being said, the usual answer there is to create models for your room database and map them to the generated models as it's usually better to separate your network and storage models. See https://github.com/apollographql/apollo-android/issues/2715
👌 1
🙏 1
a

am414

01/17/2021, 11:11 AM
thanks a lot @mbonnin i joined the channel thanks but what if i wanna add a flag(another parameter) or another method inside my data model!
m

mbonnin

01/17/2021, 11:15 AM
That's typically why you want to separate the models. If you query a new GraphQL field, your database tables will need a new column and you'll have to do a SQL migration in a ll cases. Having separate models will make this easier
3 Views