Fork me on GitHub

I'm on my pathom learning journey and am running into a problem that makes me think I'm missing some fundamental concept. In the docs, there's the latest-product resolver. I want to extend that to take an input and return a list of products. For example, I want to provide a store id and return the list of latest products for that store. Here are the resolver and query that don't work. What am I doing wrong?

(pc/defresolver latest-products-for-store [_ {::keys [store]}]
  {::pc/input  [::store]
   ::pc/output [{::store [:product/id :product/title :product/price]}]}
  (condp = store
    0 {[::store 0] [{:product/id    1
                     :product/title "Acoustic Guitar"
                     :product/price 199.99M}
                    {:product/id    2
                     :product/title "Piano"
                     :product/price 99.99M}]}
    1 {[::store 1] [{:product/id    3
                     :product/title "Clavachord"
                     :product/price 199.99M}
                    {:product/id    4
                     :product/title "Didgeridoo"
                     :product/price 990.99M}]}))
[{[::store 1] [:product/id]}]


typo in my example the ::pc/input ought to be a set instead of a vector. That doesn't change the result. The parser still returns not found


I found the issue: The output attribute is the same name as the input attribute (ie ::store) Of course, that makes no sense


nice find, I've struggled with typos and keys not matching. Maybe the defresolver macro can be enhanced to support some basic type checking like that

👍 4