wrap-cli
wrap-cli copied to clipboard
Union Types Support
Closes #246. This PR adds support for Union Types.
In order to pass a union argument, it has to comply with the following interface:
{
type: string,
value: $unionValue
}
Where type
is the name of the union member type and value
is the actual value.
Example:
Schema:
type ObjA {
prop: String!
}
type ObjB {
propB: [String!]!
}
type Union = ObjA | ObjB
Query {
foo(arg: Union): Boolean!
}
Client:
await client.query({
uri: ensUri,
query: `
query {
foo(
arg: $arg
)
}
`,
variables: {
arg: {
type: "ObjA",
value: { prop: "bar" },
}
}
});