graphql-engine
graphql-engine copied to clipboard
Docs for Boolean expressions are incomplete
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 I would like to work on this. Can you assign this to me?
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.
Is it still pending? If yes then please assign it to me, I want to contribute
@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 😃
I took a shot at handling this issue. PR open 😎
Thank you @jerempy! Your PR will be reviewed within 2 weeks, please stay tuned! 🤓