Pathom 2.3.1. Is there a way to return nil
in a field in a resolver instead of ::p/not-found
? My google-fu is failing me
oh, I just see there is p/elide-not-found
that does it already
there is a plugin that can help you there:
(def parser
(p/parser {::p/plugins [;; add this one at the end of your plugins
p/elide-special-outputs-plugin]}))
and nothing wrong with your google-fu, just not well documented
Iām not looking to replace every instance of not found, just the ones I know are nil.
Would writing a plugin that replaces something like ::p/nil
with nil on output be a reasonable solution?
if you look into the p/elide-special-outputs-plugin
, you can copy and modify it
(def elide-special-outputs-plugin
(post-process-parser-plugin elide-special-outputs))
(defn elide-special-outputs
"Convert all ::p/not-found values of maps to nil"
[input]
(elide-items special-outputs input))
(def special-outputs #{::reader-error ::not-found})
so, something like: (p/post-process-parser-plugin #(elide-items #{::p/not-found} %))
Oh I see! Thank you for the help š