https://kotlinlang.org logo
#apollo-kotlin
Title
# apollo-kotlin
g

goku

09/26/2023, 6:00 AM
Hey all, just curious if anyone run into issues with backward compatibility for Apollo generated code and how you addressed it. For example, adding a new field to a fragment is a backward incompatible change and in an evolving project it is a frequent operation. If you call constructors of the generated classes for testing, when the fragment is modified the code will break. The only work around I can think of is to deprecate(?) the fragment and create a new fragment but not sure if this is an ideal approach. I saw Data Builders can be used for Test classes but since it is experimental we won’t be able to start using it yet, but it is in the radar.
w

wasyl

09/26/2023, 6:21 AM
If a field is added to a fragment, why would you not update the usages of that fragment though? 🤔 I mean, you just changed API contract, so it sounds like the app needs to be adapted to this new contract. If this is only for tests, perhaps you're testing on a too granular level? 🤔
☝️ 1
g

goku

09/26/2023, 8:56 AM
The generated code is in a shared type repo that's consumed by multiple repositories. Given enough tine, in a big organisation, the versions pulled in by feature modules differ. You would have to go and update all clients depending on that module.