pathom

zihao 2024-09-24T09:24:24.324879Z

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

tony.kay 2024-09-24T16:46:05.693759Z

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

tony.kay 2024-09-24T16:46:47.708639Z

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.

zihao 2024-09-25T01:59:37.231519Z

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

zihao 2024-09-25T02:27:25.118949Z

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

wilkerlucio 2024-09-25T12:29:47.063969Z

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

wilkerlucio 2024-09-25T12:30:38.848859Z

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