最近我开始研究GraphQL,我能够在没有任何问题的情况下在平面模式中插入数据但是当涉及数据数组时,我收到的错误就像
{ "errors": [ { "message": "Must be input type" } ]}
Run Code Online (Sandbox Code Playgroud)
我正在使用邮递员测试我的查询,我的变异查询是
mutation M {
AddEvent
(
title: "Birthday event"
description:"Welcome to all"
media:[{url:"www.google.com", mediaType:"image" }]
location:[{address:{state:"***", city:"****"}}]
)
{title,description,media,location,created,_id}}
Run Code Online (Sandbox Code Playgroud)
这是我的事件架构:
EventType = new GraphQLObjectType({
name: 'Event',
description: 'A Event',
fields: () => ({
_id: {
type: GraphQLString,
description: 'The id of the event.',
},
id: {
type: GraphQLString,
description: 'The id of the event.',
},
title: {
type: GraphQLString,
description: 'The title of the event.',
},
description: { …
Run Code Online (Sandbox Code Playgroud)