Fork me on GitHub
#pathom
<
2019-04-09
>
Chris O’Donnell00:04:21

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.

wilkerlucio13:04:50

@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

wilkerlucio13:04:33

can you open an issue so I can track this idea to add support for graphql inner parser extensions?