Hello everyone! We are going to start internationa...
# apollo-kotlin
m
Hello everyone! We are going to start internationalising our app and we've selected the variant per country approach. Each variant will point to a backend instance which will have its own schema ( which will have similar types and custom per country types), If I understood correctly I could use
createAllAndroidVariantServices
so each variants will have their corresponding generated code, which is good. It seems though than when mapping to a domain layer I'd have to replicate mappers for the shared components ( one mapper that target each variant source code) which its a bit tedious. Has someone faced a similar scenario and could share maybe a better solution/ approach ?
b
Not sure if there’s something simpler I’m not thinking of, but you could make certain generated types implement a common interface, by hooking into the codegen (example here). Then have mappers be on the interface.
In fact, if the Apollo code is generated in the same package for all the variants, wouldn’t the mappers work automatically? Or am I missing something?
m
Well now that you mention it... I believe it should. In my head I imagined giving a different package but tbh it sounds like what you say should work
cool cheers
b
😄 tell us if it works!
m
😄 deffo, I hope I'll start working on this next week but will update once I have results