Fork me on GitHub
Jakub Holý (HolyJak)06:02:23

FYI there is err in - the text reads "use single-attr-resolver2" but the code below (pc/single-attr-resolver ::some-value ::other-value single-with-env))


thanks, fixed on master, gonna deploy updated docs later

❤️ 4

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


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


In graphql I had

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


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


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


I guess the doc could show an example of that, I was hinted by


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