This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-09
Channels
- # announcements (4)
- # beginners (44)
- # boot (15)
- # calva (66)
- # cider (66)
- # clojure (75)
- # clojure-austin (4)
- # clojure-europe (2)
- # clojure-finland (1)
- # clojure-italy (3)
- # clojure-nl (10)
- # clojure-russia (3)
- # clojure-sg (1)
- # clojure-uk (109)
- # clojurescript (18)
- # datomic (8)
- # emacs (1)
- # figwheel-main (1)
- # fulcro (5)
- # jobs (1)
- # jobs-discuss (8)
- # kaocha (7)
- # leiningen (11)
- # luminus (2)
- # off-topic (69)
- # pathom (5)
- # re-frame (7)
- # reagent (4)
- # reitit (18)
- # ring-swagger (3)
- # shadow-cljs (123)
- # spacemacs (1)
- # sql (35)
- # tools-deps (89)
- # uncomplicate (3)
- # vim (6)
- # yada (3)
It seems reasonable to me to accomplish something like this by walking the entity returned alongside the ast as a post-processing step, applying the coercion based on the key. Is there a good place to hook into the parsing process to accomplish this? I wrote a little inspector plugin that logs the env after each reader call has finished and found it was called twice with my query results (and twice with a pathom/trace key):
(def inspect-plugin
{::p/wrap-read
(fn [reader]
(fn [env]
(let [ret (reader env)]
(js/console.log {:env env :ret ret})
ret)))})
Not sure if that plugin is doing something funky, but it would be nice to inject a coercion function in a place where it just gets called once.@codonnell hello, that sounds a good extension point, currently there is already a parsing process that walks the graphql response to do things like munging and placeholder processing, but currently this part is not extensible
you can see it here: https://github.com/wilkerlucio/pathom/blob/master/src/com/wsscode/pathom/connect/graphql2.cljc#L321-L330
can you open an issue so I can track this idea to add support for graphql inner parser extensions?
Will do 👍