Reputation: 7052
I am new in GraphQL. I am learning GraphQL.
My input is like below
mutation {
createEvent:{eventInput: {title: "A Test", description:"Does this work?", price:9.99, date:"2018-12-06T09:26:30.645Z"}
}
}
I am getting error like below
{
"errors": [
{
"message": "Syntax Error: Expected Name, found {",
"locations": [
{
"line": 2,
"column": 15
}
]
}
]
}
Upvotes: 0
Views: 115
Reputation: 90517
Well, I believe your createEvent
mutation should return an object type. And for the object type , you have to specify at least one of the field from of return type for this Mutation.
It should be :
mutation {
createEvent(eventInput: {
title: "A Test"
description:"Does this work?"
price:9.99
date:"2018-12-06T09:26:30.645Z"
}){
someFieldInTheReturnType
}
}
Upvotes: 2