Fork me on GitHub
#pathom
<
2020-02-20
>
telekid01:02:14

Faaaaaaascinating. Thank you.

sif15:02:38

Hello, I'm sending params through load! params but I'm not seeing the params on pathom side uner :ast any help please?

sif16:02:37

It's all good. There was a plugin that moved those params under :query-params key in env

Brian17:02:01

What am I doing wrong here? I keep getting not-found errors

(pc/defresolver two-args [_ {:keys [num1 num2]}]
  {::pc/input  #{:num1 :num2}
   ::pc/output [:num1Squared :num1PlusNum2]}
  {:num1Squared (* num1 num1)
   :num1PlusNum2 (+ num1 num2)})

Brian17:02:30

Which I am then trying to use with the following:

(<!! (parser {} [{[:num1 2 :num2 3] [:num1Squared]}]))

Brian17:02:18

To be clear, every time I remove all the num2 references it works perfectly so the problem should be with the additional input

Brian17:02:57

Perhaps I should be using parameters..

Brian17:02:19

But I feel like you shouldn't use parameters because num1 and num2 are both required by num-args and thus they should be dependencies (inputs) not parameters

Brian18:02:38

I've also tried this mix of inputs+parameters but I get a "Key must be integer" error

(<!! (parser {} [{([:num1 3] {:pathom/context {:num2 2}})
                    [:num1PlusNum2]}]))
but my biggest concern is that if I'm passing inputs in as parameters, aren't I circumventing the whole graph thing that pathom has going for it?

Brian19:02:21

I've tried that with this code:

(<!! (parser {} [{'([:num1 3] {:pathom/context {:num2 2}})
                    [:num1PlusNum2]}]))
however I get not-found even with that

Chris O’Donnell22:02:31

That'll teach me to try to reply to people on the go. My bad! Not sure what's wrong with the above code without being able to work at a repl.

wilkerlucio13:02:52

@brian.rogers this example looks correct, did you confirmed you have registered the resolver when building the parser?

Brian15:02:54

I'm not really sure what has changed but I've ended up finding a working solution from the docs, then slowly working my way backwards towards my initial attempt until I found what the difference was. I worked my way all the way back and found that there was no difference and no mistakes and my initial attempt worked. Not sure what happened. Gotta love CS lmao

ouvasam09:02:38

I also have the same error "Key must be an integer" using something like :

(<!! (parser {} [{([:catalogue/id 1] {:where {:a 1}})
                   [:catalogue/name
                    :catalogue/status]}])))

ouvasam09:02:49

did you found a solution ?

λustin f(n)22:02:54

Why would a resolver be called without all its inputs? This has been happening fairly often for me, especially when doing deeper queries. I can sometimes 'fix' it by explicitly adding the missing input to the request at the same level, so it doesn't "forget" to get it.

λustin f(n)23:02:03

Even stranger in this case I have no problem resolving one item :foo . When I ask for a different item that requires JUST :foo , and has no other resolution paths, it takes a different strategy that causes the aforementioned error and fails.

λustin f(n)23:02:29

As if, by going one step deeper it loses track of something?