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!


2
  • 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, here, and here. Commented Jan 23, 2019 at 4:41
  • Possible duplicate of GraphQL: How to reuse same type for query and mutation? Commented Jan 24, 2019 at 14:16

0

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.