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

查看:30
本文介绍了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":"预期的输入类型."}]}

{"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天全站免登陆