Skip to content

Commit

Permalink
fix(GraphQL): This PR fix panic error when we give null value in filt…
Browse files Browse the repository at this point in the history
…er connectives. (#6707)

Fixes GRAPHQL-744

This PR fix panic error when we give null value in filter connectives. Null values corresponding to connective are skipped now.
For example in the below filter, not connective gets skipped.

```

 filter:{
      id:{eq:"123"},
      not:null
    },

```

(cherry picked from commit 345b6d1)
  • Loading branch information
JatinDev543 committed Oct 14, 2020
1 parent c2d5e66 commit d7b9a1d
Show file tree
Hide file tree
Showing 2 changed files with 365 additions and 1 deletion.
3 changes: 3 additions & 0 deletions graphql/resolve/query_rewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,9 @@ func buildFilter(typ schema.Type, filter map[string]interface{}) *gql.FilterTree
// Each key in filter is either "and", "or", "not" or the field name it
// applies to such as "title" in: `title: { anyofterms: "GraphQL" }``
for _, field := range keys {
if filter[field] == nil {
continue
}
switch field {

// In 'and', 'or' and 'not' cases, filter[field] must be a map[string]interface{}
Expand Down
Loading

0 comments on commit d7b9a1d

Please sign in to comment.