This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-16
Channels
- # announcements (3)
- # babashka (48)
- # beginners (35)
- # calva (3)
- # chlorine-clover (5)
- # clj-kondo (9)
- # cljdoc (20)
- # cljsrn (1)
- # clojure (55)
- # clojure-europe (33)
- # clojure-nl (3)
- # clojure-norway (6)
- # clojure-spec (7)
- # clojure-uk (27)
- # clojurescript (95)
- # closh (1)
- # conjure (1)
- # cursive (16)
- # datomic (30)
- # emacs (7)
- # honeysql (1)
- # hugsql (2)
- # introduce-yourself (2)
- # jobs (1)
- # lsp (30)
- # malli (22)
- # nbb (11)
- # news-and-articles (1)
- # off-topic (8)
- # pathom (21)
- # polylith (41)
- # portal (4)
- # practicalli (4)
- # protojure (1)
- # re-frame (14)
- # releases (1)
- # restql (1)
- # reveal (24)
- # sci (1)
- # sql (21)
- # vim (11)
- # xtdb (33)
Is P3 able to distinguish based on nested outputs? Say I have the following two resolvers:
(pco/defresolver something-else
[_ _]
{::pco/output [{:container [:something-else/id]}]}
{:container [{:something-else/id :bar}]})
(pco/defresolver something
[_ _]
{::pco/output [{:container [:something/id]}]}
{:container [{:something/id :foo}]})
can I then disambiguate with a nested query like:
(p.eql/process
env2
{}
[{:container [:something/id]}])
From basic testing in the repl it doesn’t seem so… the resolver last in the pci/register
call wins, so is this something P3 cannot do?hello Donavan, I have plans to support it, good to know about someone trying to use it, I kinda started but didn't finished that part yet: https://github.com/wilkerlucio/pathom3/blob/master/src/main/com/wsscode/pathom3/connect/planner.cljc#L926-L928
@wilkerlucio I took a stab at implementing this… would it best be done in the initial planning phase or as in the optimisation phase?
I add the comment in the part of code that needs to change, thats inside that function
…but that answers the question, it’s during initial planning not optimisation which is what I would expect
mmm, there is another problem to this situation that occurred to me
the nested checks are only done for dynamic resolvers, not for static ones
that's something to consider, if the planner should try going on nested things always, have to think about how that could impact performance
@wilkerlucio I am working through integrating guardrails into our in-house pathom2 macros. What would be the best way to go about supporting it? My current through it pull out the gspec parsing and run-check
functions in guardrails and use those in the forms emitted by the macros
Ideally this will look like an addition gspec line in the pathom mutations/resolvers
@royalaid if you add specs to a macro, they will always run automatically by Clojure
(pc/defresolver ex-one
"Example Resolver"
[{:keys [foo}]
{:stack/code-url (when foo
(str " " foo))})
(pc/defresolver ex-one
"Example Resolver"
[{:keys [foo}]
[map? => map?]
{:stack/code-url (when foo
(str " " foo))})
For the sake of example, this is a terrible spec but it illustrates what I am trying for
you should consider if its worth to do it, resolvers will always be [map, map] => map
(exception on batch, which is [map (coll map)] => (coll map)
, so what is the gain to add it? another idea is to instead use a plugin, with a plugin you can read input/output descriptions strait from the resolver, and than you can run spec checks on top of that