How to set null to field in graphql?

Viewed 6515

We use graphql on our project and use graphql-java 2.3.0 (we plan to update but it is not possible at the moment).

I'm trying to perform such mutation:

  mutation {
    UPDATE_User(

      id:3,
      type: null
    ) {id}
  }

Response:

{
  "errors": [
    {
      "validationErrorType": "WrongType",
      "message": "Validation error of type WrongType: argument value EnumValue{name='null'} has wrong type",
      "locations": [
        {
          "line": 5,
          "column": 7
        }
      ],
      "errorType": "ValidationError"
    }
  ],
  "data": null
}
2 Answers

In your schema, is 'type' parameter required ?

If not then simply omit it ! On your backend when you will retrieve the value of typethen it will be null

Related