The issue of how to encode polymorphism is a difficult question, how we construct the interfaces and and what layer to change them is crucial.
For example, we want to encode a base Type
, while allow sub-types such as PrimitiveType
or InterfaceType
to extend from the base type. Here is a breakdown at each layer.
We create a base interface type in GraphQL and implement it. We could also have a union type of all the sub types.
If we only want the id and label we could use the base type, but if we want