Fork me on GitHub
#pathom
<
2021-04-19
>
markaddleman02:04:48

Thanks for the update!

🙏 2
JAtkins14:04:21

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?

jmayaalv14:04:15

Pathom 3 has support for resolver prioritization https://pathom3.wsscode.com/docs/resolvers#prioritization not sure if available on pathom2.

Matheus Moreira15:04:04

Thanks, I’ll take a look.

wilkerlucio23:04:13

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

wilkerlucio23:04:39

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

wilkerlucio23:04:15

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

wilkerlucio23:04:17

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])]
    {:name-choice
     (or name-opt3
         name-opt2
         name-opt1)}))

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. 🙂