I am trying to validate a GraphQL mutation with variables and I am not clear on how to define variables - the moment I declare a variable in the query it fails validation. I am not sure where the issue is:
Schema
input ItemCreateInput {
clientMutationId: ID
}
type Mutation {
itemCreate(input: ItemCreateInput): ItemCreatePayload!
}
Query
mutation {
itemCreate(
input: $input
) {
ids
}
}
Variables
{
"input": {
"clientMutationId": 1575680625627
}
}
This rejects with Variable \"$input\" is not defined.
. But I am confused because the validate function does not accept variables as parameter so why is it validating them?
Where is the issue? how can I correctly define and pass variables?