apollo-kotlin icon indicating copy to clipboard operation
apollo-kotlin copied to clipboard

Compile-time possible types

Open martinbonnin opened this issue 2 years ago • 1 comments

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

martinbonnin avatar Aug 24 '23 11:08 martinbonnin

See also: #5808 and #5823, reverted by #5842

BoD avatar Aug 13 '24 11:08 BoD