Apollo GraphQL突变(对象参数) [英] Apollo GraphQL Mutation (Object Argument)

查看:198
本文介绍了Apollo GraphQL突变(对象参数)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在尝试设计我的Apollo服务器.我想创建一个以对象作为参数的变异.

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."}]}

推荐答案

您必须声明INPUT_OBJECT为输入类型:

You have to declare INPUT_OBJECT to be an input type:

input INPUT_OBJECT {
  field1: String,
  # etc.
}

这篇关于Apollo GraphQL突变(对象参数)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆