Value provided is incompatible with expected type

Tried to use slash today, got this error for reasons I could not understand.

Could somebody point out what I’m doing wrong., thanks in advance.

The Schema

"""
This is a User of the Application
"""
type User {
    id: ID!
    name: String!
}

The Mutation

mutation {
  addUser(input: {
    name: "Preet"
  }) {
    user {
      id
      name
    }
  }
}

The error

{
  "errors": [
    {
      "message": "Value provided {name:\"Preet\"} is incompatible with expected type [AddUserInput!]!",
      "locations": [
        {
          "line": 2,
          "column": 18
        }
      ]
    }
  ]
}
1 Like

@preetjdp your input to the mutation should be an array ([AddUserInput!]!), for example - [{name: “Preet”}] . You can see the definitions from the docs tab.

2 Likes

Ah Dumb me

Got it

Good to know. The slash graph explorer does not add the array automatically.

2 Likes