I have a Union type defined in GraphQL. Is there a way to define a AnnotatedInputType that pattern matches based on the the specific type provided by the user? I'm now using three optional Arguments, one for each of the types in my Union. It seems clunky, but works. Thanks for letting me know.
Update 1
In the starwars tests, the code instantiates human using a case statement that pattern matches
How does this approach play out in the latest iteration of the library?
Update 2
The GraphQL specification does not currently support a Union Type for an Input Object. However, it turns out I'm in good company regarding this question. There is an open RFC to discuss the benefits of implementing the feature in the specification. Here is a link.
In the meantime, there are several alternative approaches. One of them being, as the currently library allows, is to use several Arguments each with a unique field name, with optional input, one for each input type.
I have a
Union
type defined in GraphQL. Is there a way to define aAnnotatedInputType
that pattern matches based on the the specific type provided by the user? I'm now using three optionalArguments
, one for each of the types in my Union. It seems clunky, but works. Thanks for letting me know.Update 1
In the starwars tests, the code instantiates human using a case statement that pattern matches
How does this approach play out in the latest iteration of the library?
Update 2
The GraphQL specification does not currently support a
Union Type
for anInput Object
. However, it turns out I'm in good company regarding this question. There is an openRFC
to discuss the benefits of implementing the feature in the specification. Here is a link.In the meantime, there are several alternative approaches. One of them being, as the currently library allows, is to use several
Argument
s each with a unique field name, with optional input, one for each input type.- E