Fork me on GitHub
#pathom
<
2020-02-28
>
Jakub Holý (HolyJak)06:02:23

FYI there is err in https://wilkerlucio.github.io/pathom/v2/pathom/2.2.0/connect/resolvers.html#_single_attribute_resolvers - the text reads "use single-attr-resolver2" but the code below (pc/single-attr-resolver ::some-value ::other-value single-with-env))

wilkerlucio15:02:34

thanks, fixed on master, gonna deploy updated docs later

❤️ 4
yenda15:02:45

I have a defresolver that already returns some of the nested attributes after running a big composed sql query with json aggregates, how can I query these nested attributes? I get :com.wsscode.pathom.core/not-found while if I don't ask for any and just put the key I get the map that is there in the reply

yenda15:02:07

interstingly if I use placeholder syntax I get the queried attributes, but only because another resolver is used for that

yenda15:02:49

In graphql I had

(defn- idempotent [field next] (fn [root args context info]
    (if-let [field-value (get (utils/gql->clj root) field)]
      field-value
      (next root args context info))))
around resolvers for attributes that might have already been solved by earlier resolvers

yenda15:02:23

What would be the best approach with pathom? So far I'm pretty stoked by the lib and looking forward to replace graphql entirely

yenda17:02:45

ok it was somewhat easier than I thought, I simply add to nest the subfields in the ::pc/output

yenda17:02:43

I guess the doc could show an example of that, I was hinted by https://wilkerlucio.github.io/pathom/#_query_notation_introduction

yenda17:02:56

actually the reason I couldn't get it to work was slightly more complex, I was reading :query in the ast to get the fields and compose the sql query and naively expected keywords, but ofc as soon as I started specifying subfields, the elements in the query also contained maps, so my sql query didn't contain the field I was looking for anymore 😄

simple_smile 4