This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-05
Channels
- # announcements (9)
- # babashka (7)
- # beginners (190)
- # calva (5)
- # cider (12)
- # clara (1)
- # clj-kondo (26)
- # cljdoc (3)
- # cljsrn (5)
- # clojure (15)
- # clojure-australia (2)
- # clojure-czech (1)
- # clojure-europe (34)
- # clojure-germany (2)
- # clojure-nl (6)
- # clojure-spec (20)
- # clojure-uk (7)
- # clojurescript (6)
- # cloverage (2)
- # conjure (10)
- # core-async (18)
- # core-logic (1)
- # cursive (22)
- # data-science (1)
- # datalog (26)
- # datomic (35)
- # docker (1)
- # emacs (4)
- # etaoin (4)
- # fulcro (51)
- # jobs (2)
- # jobs-discuss (2)
- # joker (1)
- # leiningen (4)
- # mid-cities-meetup (1)
- # off-topic (22)
- # pathom (15)
- # re-frame (14)
- # reitit (5)
- # remote-jobs (1)
- # shadow-cljs (37)
- # specter (2)
- # tools-deps (43)
- # xtdb (2)
What is the typical way of setting up a resolver where you might not know all the outputs from the api response something like:
(pc/defresolver some-resolver
[__ {:keys [resource/id]}]
{::pc/input #{:resource/id}
::pc/output [:id]}
(let [resource (get-resource-by-id id)]
resource))
where I could still query other parts of the response like: `[{[:resource/id 1] [:id :name]}]`
@njustice Pathom needs to know the output ahead of time, otherwise it can't figure the proper resolve to call an attribute
so you can't have that open
dynamic resolvers can be a bit more cherry picking on it, but they still need to know all possibilities ahead of time
You sort of can have it open, if you build a resolver by id, but have it return all data, you can then use something like filter to pull out what you need. fulcro-rad-demo does it with attributes that have a name starting with "all-". But pathom won't be able to query by any of that output unless it's in the output list.
@wilkerlucio in my example, I get back the :name
w/o including it in the pc/output
@njustice the problem is that this makes it a an implicit dependency, in a way its like getting it by accident. the problem is that if you don't ask for the id, you will never get :name
. also, I like to discourage you from having unqualified attributes in the system (input or output) due that it will easaly collide with other things
so for any resource I have, if I want to use a field from it, I need to include it in the output
Or stuff them all into a hash-map under one key. The contents of the hash-map under this key become arbitrary
yes, you can think of it as your schema in a way