我是GraphQL的新手。我正在学习GraphQL。
我的输入如下所示
mutation {
createEvent:{eventInput: {title: "A Test", description:"Does this work?", price:9.99, date:"2018-12-06T09:26:30.645Z"}
}
}
我遇到如下错误
{
"errors": [
{
"message": "Syntax Error: Expected Name, found {",
"locations": [
{
"line": 2,
"column": 15
}
]
}
]
}
答案 0 :(得分:2)
好吧,我相信您的createEvent
突变应该返回一个对象类型。对于对象类型,您必须为此Mutation指定返回类型的至少一个字段。
应该是:
mutation {
createEvent(eventInput: {
title: "A Test"
description:"Does this work?"
price:9.99
date:"2018-12-06T09:26:30.645Z"
}){
someFieldInTheReturnType
}
}