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

本文是小编为大家收集整理的关于Apollo GraphQL突变(对象参数)的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

所以,我正在尝试设计我的阿波罗服务器.我想用对象作为参数创建一个突变.

这是我的模式的片段,以某种方式引起了问题:

在此处输入图像说明

我认为这是句法正确的,但是我遇到了这个错误:

{" errors":[{"消息":"预期输入类型."}]}

推荐答案

您必须将Input_Object声明为输入类型:

input INPUT_OBJECT {
  field1: String,
  # etc.
}

本文地址:https://www.itbaoku.cn/post/1938154.html

问题描述

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:

enter image description here

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

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

推荐答案

You have to declare INPUT_OBJECT to be an input type:

input INPUT_OBJECT {
  field1: String,
  # etc.
}