Apollo GraphQL Mutation (Object Argument)

白昼怎懂夜的黑 提交于 2020-01-04 05:15:28

问题


So, I'm trying to design my Apollo server. I wanted to create a mutation with an object as a parameter.

Here is a snippet of my schema which somehow caused the problem:

I thought it was syntactically correct, but I ran into this error:

{"errors":[{"message":"Expected Input type."}]}


回答1:


You have to declare INPUT_OBJECT to be an input type:

input INPUT_OBJECT {
  field1: String,
  # etc.
}


来源:https://stackoverflow.com/questions/39759988/apollo-graphql-mutation-object-argument

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!