This repository was archived by the owner on Dec 31, 2024. It is now read-only.

Description
Hello,
When using variables in query, the inputType never get validated.
Assuming we're using your Star Wars schema, the following will work, whatever the side input in variables :
var HeroInputType = UnionInputType({
name: 'hero',
inputTypes: [JediInputType, SithInputType], //an object can be used instead to query by names other than defined in these types
typeKey: 'side'
});
[...]
graphql(Schema, `
mutation($hero: HeroInputType!) {
hero(input: $hero) {
...
}
}
`, {}, {}, {
hero: {
side: 'WHATEVER'
}
});