Vincit / venia

Clojure(Script) graphql query generation
Eclipse Public License 1.0
197 stars 20 forks source link

UnsupportedOperationException nth not supported on this type: Keyword #19

Closed AndreTheHunter closed 7 years ago

AndreTheHunter commented 7 years ago

Reoccurring from #8

I get the error: UnsupportedOperationException nth not supported on this type: Keyword clojure.lang.RT.nthFrom (RT.java:965) When running:

(venia.core/graphql-query
  {:venia/queries [[:employee {:id 1 :active true}
                    [:name {:preferNickname 1}
                     :address
                     [:friends
                      [:name
                       :email]]]]]})

Using [vincit/venia "0.2.4"] with [org.clojure/clojure "1.9.0-beta2"]

macluck commented 7 years ago

@AndreTheHunter You need to wrap :name {:preferNickname 1} in vector:

(venia.core/graphql-query
  {:venia/queries [[:employee {:id 1 :active true}
                    [[:name {:preferNickname 1}]
                     :address
                     [:friends
                      [:name
                       :email]]]]]})

Probably, I should have documented it better. Also, i should definitely improve error messages, because quite often they don't make any sense.

AndreTheHunter commented 7 years ago

@macluck Thanks, that sorted it out! Yes, please update the documentation to make it clearer