Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when providing nested input object via variables #60

Closed
stijnopheide opened this issue May 10, 2017 · 0 comments · Fixed by #61
Closed

Error when providing nested input object via variables #60

stijnopheide opened this issue May 10, 2017 · 0 comments · Fixed by #61

Comments

@stijnopheide
Copy link
Contributor

This is a minimal case to reproduce (v 0.16.0)

Schema

(def schema
  {:input-objects {:IDObject {:fields {:id {:type '(non-null String)}}}}
   :objects       {:Something  {:fields {:id         {:type '(non-null String)}
                                         :name       {:type 'String}
                                         :otherThing {:type :OtherThing}}}
                   :OtherThing {:fields {:id   {:type '(non-null String)}
                                         :name {:type 'String}}}}
   :mutations     {:CreateSomething
                   {:args {:name {:type 'String}
                           :otherThing {:type :IDObject}}
                    :type :Something}}})

Execute the query by filling in parameters directly

(com.walmartlabs.lacinia/execute (com.walmartlabs.lacinia.schema/compile schema)
                                 "mutation CreateSomething { CreateSomething(name: \"Test\", otherThing: {id: \"ID\"}) {id }}"
                                 nil
                                 nil)
=> {:data #ordered/map([:CreateSomething nil])}

Execute the query by providing variables

(com.walmartlabs.lacinia/execute (com.walmartlabs.lacinia.schema/compile schema)
                                 "mutation CreateSomething($name: String!, $otherThing: IDObject!) { CreateSomething(name: $name, otherThing: $otherThing) {id }}"
                                 {:name "Test"
                                  :otherThing {:id "ID"}}
                                 nil)
=> {:errors [{:message "Sanity check - no option in process-result."}]}

The error happens in com.walmartlabs.lacinia.parser/process-result because there is no matching clause in the cond for (= category :input-object).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant