steph
steph

Reputation: 189

Sending an array of objects to GraphQL

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.

Upvotes: 2

Views: 647

Answers (1)

Marco Daniel
Marco Daniel

Reputation: 5765

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.

Upvotes: 1

Related Questions