This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-11
Channels
- # adventofcode (33)
- # babashka (1)
- # beginners (11)
- # biff (3)
- # calva (2)
- # cider (24)
- # clj-kondo (9)
- # cljfx (5)
- # clojure (39)
- # clojure-austin (2)
- # clojure-europe (11)
- # clojure-nl (1)
- # clojure-norway (22)
- # clojure-uk (10)
- # community-development (18)
- # data-science (24)
- # datahike (3)
- # events (3)
- # hyperfiddle (11)
- # lsp (22)
- # malli (3)
- # matrix (1)
- # off-topic (24)
- # other-languages (3)
- # overtone (7)
- # pathom (5)
- # reitit (2)
- # shadow-cljs (34)
- # sql (20)
- # squint (13)
Are there polymorphic options in Pathom3 for resolvers to dispatch on values rather than keys (i.e. instead of union resolvers)?

Oh my gosh, apparently I’ve asked this before :man-facepalming:: https://clojurians.slack.com/archives/C87NB2CFN/p1669921272838849
Happens to the best of us.
Some other solutions that come to mind are:
1. One resolver that converts {:color :red} => {:red true}
, and then many resolvers for each color
2. You can also have many color resolvers that all have the same input: [:color]
. Each of the resolvers will check if the color value matches its respective color, and when it doesn’t, it returns ::pco/unknown-value
. Pathom will try each resolver, one after another, until one returns a value.
3. Similar to 1, you could transform the value into a key before processing it in pathom.
1 & 2 probably won’t get any help from the query planner. 3 probably would though.
@U3XCG2GBZ #3 is really creative. I like that.