hasura / hasura/graphql-engine
With json filter queries, `_gt` and ` _lt` are inversed
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version:
Server & cli `v2.0.7`
## Description
When querying a json using a filter `_where` `_gt` and `_lt` are inversed.
Let's me show you this query
```graphql
{
scores: inventories(where: {ppi: { _gt: { fake_ee: { score: 345}} }}) {
id
score: ppi(path: "fake_ee.score")
}
ids: inventories(where: {id: {_gt: 100}}) {
id
}
}
```
So we are expecting
- :x: `scores`: all the `inventories` with a score higher than `345`
- :heavy_check_mark: `ids` all the `inventories` wuth an id greater than `100`
Lets me show you the result
```json5
{
"data": {
"scores": [
{
"id": 104,
"energy_score": 213 # as you can see, this score is lower than 345
},
{
"id": 102,
"energy_score": 297 # as you can see, this score is lower than 345
},
# [...]
],
"ids": [
{
"id": 101
},
{
"id": 102
},
{
"id": 103
},
# [...]
]
}
}
```
Contributor guide
Research direction
Reproduce the reported GraphQL query against server and CLI v2.0.7 using the JSON filter on inventories, comparing the nested ppi score condition with the numeric id condition. Trace the `_where` handling for `_gt` and `_lt`; done means scores greater than 345 are returned and the existing id-greater-than-100 behavior remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100