Skip to content

Commit d7b9a1d

Browse files
committed
fix(GraphQL): This PR fix panic error when we give null value in filter 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)
1 parent c2d5e66 commit d7b9a1d

File tree

2 files changed

+365
-1
lines changed

2 files changed

+365
-1
lines changed

graphql/resolve/query_rewriter.go

+3
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,9 @@ func buildFilter(typ schema.Type, filter map[string]interface{}) *gql.FilterTree
10141014
// Each key in filter is either "and", "or", "not" or the field name it
10151015
// applies to such as "title" in: `title: { anyofterms: "GraphQL" }``
10161016
for _, field := range keys {
1017+
if filter[field] == nil {
1018+
continue
1019+
}
10171020
switch field {
10181021

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

0 commit comments

Comments
 (0)