3

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

1 Answer 1

11

You have to declare INPUT_OBJECT to be an input type:

input INPUT_OBJECT {
  field1: String,
  # etc.
}
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! You're a life saver.
@helfer may I have 2 definitions for INPUT_OBJECT? one type and other input with the same name (if also I want to query)? Or should I declare one for query and other for mutation?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.