Closed ntestoc3 closed 4 years ago
Modifying the graphql-builder.generators.shared/argument-value function can solve this problem:
(with-redefs-fn {#'graphql-builder.generators.shared/argument-value
(fn [argument config]
(let [value (:value argument)
variable-name (:variable-name argument)]
(cond
(not (nil? value)) (graphql-builder.generators.shared/argument-value-value argument)
(not (nil? variable-name)) (str "$" (graphql-builder.generators.shared/add-var-prefix (:prefix config) variable-name)))))
}
#((get-in (graphql/query-map
(parse "query Foo {
productList(someArg: moo, otherArg: false) {
name
}
}"))
[:query :foo] )))
;; => {:graphql
;; {:operationName "Foo",
;; :query
;; "query Foo {\n productList(someArg: moo, otherArg: false) {\n name\n }\n}",
;; :variables {}},
;; :unpack #function[clojure.core/identity]}
@ntestoc3 Thank you for reporting this. It's fixed in 17cec0f37f5f3f203a13cff186748ba2a178e204 and new version (0.1.10) is pushed to Clojars
When the arg value is false, the constructed query string loses the false value.
The following example code: