I'm trying to do a simple mutation using GraphQL with the GraphiQL interface. My mutation looks like this:
mutation M($name: String) {
addGroup(name:$name) {
id,
name
}
}
with variables:
{
"name": "ben"
}
But it gives me the error: Variable $name of type "String" used in position expecting type "String!"
If I change my mutation to mutation M($name: String = "default")
it works as expected. This looks like it's related to the type system, but I can't seem to figure out what the problem is.
!
was the issue... Alas it does make sense! – Treenatreenail