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

Docs for Boolean expressions are incomplete

Open abooij opened this issue 3 years ago • 6 comments
trafficstars

The API docs specify that a Boolean expression (e.g. for where clauses) is one of five options. https://github.com/hasura/graphql-engine/blob/52873dba95df9aac8dfee174597c7967291e4828/docs/docs/api-reference/graphql-api/query.mdx#L366-L384 In particular, ColumnExp simply represents a comparison operator. https://github.com/hasura/graphql-engine/blob/52873dba95df9aac8dfee174597c7967291e4828/docs/docs/api-reference/graphql-api/query.mdx#L578-L620

At first sight, this is matched by the internal Haskell representation: a GBoolExp is one of five options. https://github.com/hasura/graphql-engine/blob/52873dba95df9aac8dfee174597c7967291e4828/server/src-lib/Hasura/RQL/IR/BoolExp.hs#L81-L90 However, in most cases, the a type parameter used by BoolFld is filled in by AnnBoolExpFld: https://github.com/hasura/graphql-engine/blob/52873dba95df9aac8dfee174597c7967291e4828/server/src-lib/Hasura/RQL/IR/BoolExp.hs#L504-L517 This allows for not just a binary operator on a column (AVColumn), but also for deeper Boolean expressions in the case of relationships and computed fields.

Concretely, this means that something like

query {
  articles(where: {author: {hometown: {_eq:"Amsterdam"}}}) {
    title
  }
}

is not considered a valid query by the documentation.

Was this part of the documentation possibly written before support for DB table relationships was added? In any case, it didn't get improved after computed fields were added.

abooij avatar Oct 03 '22 15:10 abooij

@abooij I would like to work on this. Can you assign this to me?

omjikush09 avatar Oct 03 '22 18:10 omjikush09

Hey, @omjikush09 thank you for your interest, feel free to work on this! FYI - We don't assign issues. The first PR raised will be reviewed, so far nobody has raised a PR.

Stefmore02 avatar Oct 03 '22 18:10 Stefmore02

Is it still pending? If yes then please assign it to me, I want to contribute

TiwariAbhishek23 avatar Oct 05 '22 07:10 TiwariAbhishek23

@AbhishekTiwari23 Hello, thank you for your interest! We don't assign issues. The first PR raised will be reviewed, so far nobody has raised a PR. Feel free to contribute 😃

Stefmore02 avatar Oct 06 '22 00:10 Stefmore02

I took a shot at handling this issue. PR open 😎

jerempy avatar Oct 12 '22 22:10 jerempy

Thank you @jerempy! Your PR will be reviewed within 2 weeks, please stay tuned! 🤓

Stefmore02 avatar Oct 12 '22 22:10 Stefmore02