2

I'm trying to feed an array of objects from a React app to GraphQL. But I'm getting this error:

   Error: The type of Mutation.reorderFields(fieldsOrder:) must be Input Type but got: [orderField].

This is my schema:

  reorderFields(
    fieldsOrder:[orderField]
  ):Boolean!

Mutation:

  type orderField{
    order: Int,
    myform: String,
    id: String,
  }

Any help would be appreciated, thank you.

2
  • But doesn't that mean that the type of the orderField should be boolean, or do I read it absolutely wrong? Commented Jun 11, 2018 at 22:45
  • 1
    @JaakkoKarhu the :Boolean is the return type of the reaorderFields() not the input type. Commented Jun 12, 2018 at 8:31

1 Answer 1

1

I believe the problem might be on GraphQL server. Because your orderField is defined as object type and it probably should be defined as a input type.

In GraphQL mutation the data payload needs to be defined as input type.

Check Mutations and Input Types for a better description on how to make mutations.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.