Closed th3coop closed 1 year ago
Some notes from the digging I did last night:
It looks like the issue is that when extracting the Interface data from the Introspection data, possibleTypes
is used to see ultimately, what fragments
it can have. Child interfaces are not included in that list:
https://github.com/dillonkearns/elm-graphql/blob/master/generator/src/Graphql/Generator/Group.elm#L46
To include the child Interface, it looks like you (the royal you (is that a thing?)) need to look at ALL the available Interfaces and see if their "interfaces": [],
field is populated, and if it is, update any Interfaces listed with the current Interface
name as a "possibleType" so it makes it into the Fragments
type of the parent Interface
.
Another option could be to not look at the possibleTypes
field at all and only look at the interfaces
field for every type then update the Interfaces
possibleTypes
. I could imagine a performance hit with this option though with really big and complex schemas though how much of one, I have not the slightest clue.
When you have nested Interfaces in your schema, the "child" Interface is missing from the "parent" Interface.Fragments type.
Given an SDL:
The resulting
Interface.Character.Fragments
type will be as follows:But it should be this: