2

My problem is that, i make a mutation to update company profile, but when I put the networks field I get an error.

I am using buildSchema.

type Network {
  name: String
  url: String
}

input UpdateCompanyInput {
     name: String
     networks: [Network]
} 

When i try it in GraphiQL:

mutation {
  updateCompanyProfile(updateCompanyInput: {name: "Test"}) {
    name
  }
}

I got this error:

    {
      "errors": [
        {
          "message": "The type of UpdateCompanyInput.networks must be Input Type but got: [Network].",
          "locations": [
            {
              "line": 95,
              "column": 13
            }
          ]
        }
      ]
    }



Thanks!


Kali33
  • 21
  • 3
  • As the error indicates, the `networks` field must be an Input type, not an Object type (`Network` is an Object type, not an Input type). This is a duplicate question. See [here](https://stackoverflow.com/questions/54119116), [here](https://stackoverflow.com/questions/52744900), and [here](https://stackoverflow.com/questions/46158288). – Daniel Rearden Jan 23 '19 at 04:41
  • Possible duplicate of [GraphQL: How to reuse same type for query and mutation?](https://stackoverflow.com/questions/46158288/graphql-how-to-reuse-same-type-for-query-and-mutation) – thibpat Jan 24 '19 at 14:16

0 Answers0