graphql-ppx icon indicating copy to clipboard operation
graphql-ppx copied to clipboard

Type error setting nullable integer field to null

Open nireno opened this issue 4 years ago • 0 comments

In Hasura, a nullable field order can be set to null with this mutation:

mutation ($id: String!) {
  update_table_by_pk(pk_columns: {id: $id}, _set: {order: null}) {
    id
  }
}

But in Reason we're getting: Invalid argument. Expected "Int" but received "Null!".

A workaround is to use a nullable parameter and simply omit it when calling makeVariables:

mutation ($id: String!, $nullableInt: Int) {
  update_table_by_pk(pk_columns: {id: $id}, _set: {order: $nullableInt}) {
    id
  }
}

nireno avatar Nov 05 '20 12:11 nireno