apollo-kotlin
apollo-kotlin copied to clipboard
Compile-time possible types
Use case
Currently the generated __Schema class contains a possibleTypes(type: CompiledNamedType) method that computes the possible types of a given interface/union.
This works by iterating the list of all types (__Schema.all) and collecting the possible types as it goes. While this is working well, this is doing work at runtime. Also because __Schema.all references all schema types, it makes it impossible for R8 to remove the unused types.
Describe the solution you'd like
Like for the web client, we could generate the possible types at build time and let R8 prune that
See also: #5808 and #5823, reverted by #5842