Hasura query nullable variable

Hasura query nullable variable


0

I am trying to get superior id one by one from my database, but the last one will be allways nullable and i don´t know how to be able to ask in Int type varible for null value.

I tried this query which function untill i use the null value.

query GetSortHierarchy($device_id: Int!, $filter_id: Int!, $superior_id: Int) {
  devices_by_pk(id: $device_id) {
    filter_types(where: {id: {_eq: $filter_id}}) {
      sort_groups(where: {superior_id: {_eq: $superior_id}}) {
        id
        name
        rank
        sort_group {
          id
          superior_id
        }
        superior_id
      }
    }
  }
}

with those variables

{"device_id": 156, "filter_id": 1, "superior_id": null}

And it returns this message
"message": "unexpected null value for type 'Int'".

I know about is_null check but i would prefer single query and not two, one for null and second for the rest.


Load 3 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *