pathom 2024-09-24

Hi Pathom devs. I have two resolvers output different attributes in the same context

(pco/defresolver output1 []
    {::pco/output [{:context [:o1]}]}
    {:context {:o1 "o1"}})

  (pco/defresolver output2 []
    {::pco/output [{:context [:o2]}]}
    {:context {:o2 "o2"}})
I can query either [{:context [:o1]}] or [{:context [:o1]}] but not both [{:context [:o1 :o2]}] Is it because when merge-attribute the whole map is replaced? should I write a plugin to change merge-attribute to merging two :context value

In this case your context is a constant..you don’t even need it. Just make resolvers whose outputs are :o1 and :o2 respectively…unless by using the idea of context you mean that there is an unspoken input

on a join, the resolver should be providing something that IS the context (e.g. an ID), and then other resolvers will have a required INPUT (e.g. that ID) for providing the other details.

I use context here because there are already :o1 :o2 in outer scope, they have different value than :o1 :o2 in :context

maybe I should separate them using namespace in attribute, :o1 for and :context.o1

in short, you can't, each attribute can only be resolved once, so or you will get :context from output1 OR from output2, but never from both

but as you said, if you separate then with different names, a resolver can require nested inputs from both and merge in some other key