Passing in variables wrapped in an array comes in as a double array
jantorestolsvik opened this issue · 5 comments
Hi, the following does not work as expected. The variable received in the resolver if $a is "a" is [["a"]] instead of ["a"] which I would expect.
mutation TestMutation (
$a: String!
) {
test_mutation(string_list: [$a]) {
id
}
}
What is the schema for test_mutation in the above example?
Today's my day to work on open source; I'll see if I can reproduce this easily.
My first take on reproducing this didn't work:
(deftest vars-in-array-pass-thru-correctly
;; See https://github.com/walmartlabs/lacinia/issues/434
(let [schema (schema/compile {:queries
{:echo
{:type :String
:args {:input {:type '(list String)}}
:resolve (fn [_ args _]
(pr-str args))}}})
result (execute schema
"query ($s: String) {
echo (input: [$s])
}"
{:s "lacinia"}
nil)]
(is (= {:data {:echo "{:input [\"lacinia\"]}"}}
result))))
The above should fail if this bug is valid, but doesn't. Perhaps there's something more I'm missing.
Please re-open if you can come up with a test case.
Thanks for looking into it. We are also using lacinia-pedestal, so I thought the error might be there then. I could not replicate it there either. I will check on our end if we are doing something weird with interceptors or something.