teamwalnut / graphql-ppx

GraphQL language primitives for ReScript/ReasonML written in ReasonML
https://graphql-ppx.com
MIT License
259 stars 54 forks source link

Type error setting nullable integer field to null #217

Open nireno opened 3 years ago

nireno commented 3 years ago

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
  }
}