Fork me on GitHub

Is it necessary to specify ::pc/output of a resolver? I’ve noticed that if I don’t query for any keys that exist in the ::pc/output vector, then my resolver stops working (all keys are :not-found).


yes, that’s required, there are a few cases in which Pathom can infer the output, but only very simple cases, for the most part you need to define the output


Ah right. It took me too long to realize, but without the output you wouldn’t know which resolver to actually call…


But if I query for even one key that matches what’s in ::pc/output, now it’s able to find keys that weren’t declared ahead of time.


this happens because pathom just merges the result, and them you kind get it by accident


think that pathom uses ::pc/output to generate the attribute index, if you try to lookup for something and its not there, pathom will make it not-found


this is how you can get the “work by accident” case:

(pc/defresolver x []
  {::pco/output [:a]}
  {:a 1 :b 2})

(parser [:a :b])


the :a attribute made pathom call x, which had the full result merged (`{:a 1 :b 2}`), now, when looking for :b it sees its already on the entity data, so it works


but if you remove :a from this query (as : (parser {} [:b])), it wont, because :b isn’t indexed