pathom

J 2025-04-08T15:23:34.634319Z

Hi guys! I have a document like:

{:foo/id "..."
 :foo/a "1"
 :foo/b "2"
 :foo/c ["3" "4"]}
The keys foo/a, foo/b, foo/c are ids of the same table (call it table baz) Now I would like to expand those keys with baz data. To have something like:
{:foo/id "..."
 :foo/a_expanded {:baz/id "1"}
 :foo/b_expanded {:baz/id "2"}
 :foo/c_expanded [{:baz/id "3"}
                  {:baz/id "4"}]}
What is the best way to group all the baz id and do one request to baz?

wilkerlucio 2025-04-29T17:03:21.906549Z

hi @jean.boudet11, sorry the delay, not yet, but I made an issue so I dont lose track of it: https://github.com/wilkerlucio/pathom3/issues/231

wilkerlucio 2025-04-11T17:33:21.687589Z

from your other comment I guess you found this is done via batch resolvers?

J 2025-04-11T18:38:15.905079Z

Hi! Thanks to your answer. Yes, I already use batch resolver with async (promesa) but the overall eql process takes time (severals seconds). So I try to known if my resolver are ok. For context, I have mongodb documents with heavily nested resources. For the moment my strategy to "embed" resources is: • Each resources have a global batch resolver for example:

(pco/defresolver baz-batch-resolver
  [env items]
  {::pco/input [:baz/_id]
   ::pco/output [<baz-fields>]
   ::pco/batch? true}
  (p/future
   ...)
• When I want a "join" I have this kind of resolver:
(pco/defresolver foo-a-expanded-resolver
  [env item]
  {::pco/input [:foo/a]
   ::pco/output [{:foo/a_expanded [:baz/_id]}]
  {:foo/a_expanded {:baz/_id (get item :foo/a)}})
So from the previous example my eql looks like for example:
[:foo/_id
 {:foo/a_expanded [:baz/_id :baz/name]}
 {:foo/b_expanded [:baz/_id :baz/name]}
 {:foo/c_expanded [:baz/_id :baz/name]}
Is this a good practise or is a bit complex?

J 2025-04-30T07:38:38.982199Z

No worries @wilkerlucio. Thanks to create the issue

wilkerlucio 2025-04-13T15:59:57.836569Z

not sure if I fully understand, can you write me minimal reproduction so we get in the smae page?

J 2025-04-14T09:01:45.107419Z

Hi! You can find the repro here: https://gist.github.com/jeans11/7f03cdeee5552a6f868789c5483106b4

J 2025-04-28T03:22:13.480779Z

Hi! Any updates on this?