Fork me on GitHub
#graphql
<
2018-06-22
>
Angelo15:06:43

Another question~ more specific to GraphQL In GraphQL if I wanted to build a query list all games what would that query look like?

Angelo15:06:50

{
  games {
    id
  }
}
I would assume I would need to build a new resolver for this?

orestis15:06:36

You gave to name all your queries explicitly, so yes you need a resolver for every query.

orestis15:06:12

Perhaps resolvers are reusable though, or you could use a resolver factory.

Angelo15:06:29

So in the case of putting a resolver in the schema

Angelo15:06:31

{:BoardGame
(Put resolver here?)
  {:description "A physical or virtual board game."
   :fields
   {:id {:type (non-null ID)}
    :name {:type (non-null String)}
    :rating_summary {:type (non-null :GameRatingSummary)
                     :resolve :BoardGame/rating-summary}
    :summary {:type String
              :description "A one-line summary of the game."}}}
Where would I exactly put it?

Angelo18:06:44

nvm realized I just put it under queries and the resolver map 🙂

Angelo19:06:51

Sorry for asking so much

Angelo19:06:37

So when I write a query like

:get_all_games
  {:type (list :BoardGame)
   :resolve :query/all-games}

Angelo19:06:14

and then my resolver map

:query/all-games (all-games db)

Angelo19:06:38

Its still throwing me

ExceptionInfo Resolver specified in schema not provided.  clojure.core/ex-info (core.clj:4617)

hlship21:06:00

That should work, there’s likely details were not seeing to explain the failure.

Angelo21:06:40

Thats what I am struggling to find out, I comment out the offending query and it works but it really doesn't give much guidance to help me debug this 😕