Fork me on GitHub

Thanks for the update!

🙏 2

This is AWESOME! I’ve been thinking about this + the visualization style for a long time, and it’s really neat seeing it actually used somewhere. Makes me even more interested in working on tooling to simplify these kinds of tools :)

🙂 2
Matheus Moreira09:04:24

Hello! Recently I started playing with Pathom 2 and now I have a situation where I have 3 resolvers that produce the same output (:tournament/full-name) but require different inputs and I would like to give them some kind of priority or an order by which they should be tried. Is it possible to do it?


Pathom 3 has support for resolver prioritization not sure if available on pathom2.

Matheus Moreira15:04:04

Thanks, I’ll take a look.


modeling wise, I think of this as first having 3 different attributes, one for each name path, the important part is just to be able to talk about them as different things


them, another resolver can ask for the 3 of them, and decide the order based on the available options


in Pathom 3 you can use a resolver with 3 optional inputs and make the choice there, in Pathom 2, since there are no optional inputs, what you can do is make a resolver that depends the most broad of the options (the case most easy to access, so it just enough for the engine to trigger it), and inside of the resolver you can call the parser to fetch the other 2 options


something like:

(pc/defresolver select-name 
  [{:keys [parser] :as env} {:keys [name-opt1]}]
  {::pc/output [:name-choice]}
  (let [{:keys [name-opt2 name-opt3]}
        (parser env [:name-opt2 :name-opt3])]
     (or name-opt3

Matheus Moreira15:04:59

Ah, nice! I’ll try to implement it in my code base. By the way, good to know that you are in the Clojure Brasil group. 🙂