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
bod
11/24/2022, 3:05 PM
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.
bod
11/24/2022, 3:10 PM
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
Marco Pierucci
11/24/2022, 3:14 PM
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
Marco Pierucci
11/24/2022, 3:14 PM
cool cheers
b
bod
11/24/2022, 3:14 PM
😄 tell us if it works!
m
Marco Pierucci
11/24/2022, 3:15 PM
😄 deffo, I hope I'll start working on this next week but will update once I have results