Fork me on GitHub
#pathom
<
2021-08-23
>
lsenjov06:08:08

I'm a bit stuck on a use case. I'm wanting to take the example from https://blog.wsscode.com/pathom/v2/pathom/2.2.0/connect/resolvers.html#_n1_queries_and_batch_resolvers , but instead of having the total stored under :items, instead bring it up to the top level map next to :items as something like :total-items. I'm not sure how to add the nested query into the inputs set on a resolver, or even if it's possible I've been playing with

(pc/defresolver total-items-resolver
  {::pc/input #{[{:items [:number]}]}
   ::pc/output [:total-items}
  ...)
and request with
(parser {} [:total-items])
which in my mind matches the list-things resolver from the example, then can operate on that. So far I can't figure out how to do it. Is there a way to do this currently or am I barking up the wrong tree?

wilkerlucio13:08:56

hello, it looks like what you want is nested inputs, Pathom 2 doesn't have support for that

lsenjov05:08:47

Oh that works perfectly! Thank you so much!

stuartrexking23:08:03

Are pathom 2.4 resolvers and mutations directly invokable like they are in pathom 3?

stuartrexking23:08:17

I want to unit test them in isolation (without a parser)

stuartrexking23:08:21

The answer is no, they are just maps.