This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-17
Channels
- # announcements (3)
- # beginners (107)
- # calva (13)
- # clj-kondo (5)
- # cljsrn (21)
- # clojure (99)
- # clojure-australia (8)
- # clojure-dev (51)
- # clojure-europe (108)
- # clojure-nl (1)
- # clojure-portugal (3)
- # clojure-spec (9)
- # clojure-uk (10)
- # clojurescript (147)
- # component (7)
- # conjure (5)
- # core-async (2)
- # cursive (11)
- # datomic (11)
- # emacs (14)
- # graalvm (163)
- # graalvm-mobile (317)
- # honeysql (15)
- # introduce-yourself (4)
- # jobs (3)
- # lambdaisland (1)
- # lsp (19)
- # luminus (3)
- # malli (17)
- # off-topic (10)
- # pathom (11)
- # reagent (10)
- # remote-jobs (2)
- # ring (1)
- # shadow-cljs (22)
- # test-check (2)
- # testing (5)
- # tools-deps (39)
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
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]}))
š 3
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 just see there is p/elide-not-found
that does it already