This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-05-13
Channels
- # announcements (1)
- # babashka (2)
- # biff (10)
- # cider (11)
- # clara (17)
- # clerk (10)
- # clojure (21)
- # clojure-berlin (4)
- # clojure-brasil (1)
- # clojure-europe (32)
- # clojure-nl (1)
- # clojure-norway (18)
- # clojure-uk (10)
- # cursive (2)
- # data-science (11)
- # datomic (10)
- # emacs (8)
- # events (7)
- # fulcro (29)
- # gratitude (2)
- # honeysql (21)
- # hyperfiddle (7)
- # lsp (2)
- # malli (4)
- # polylith (4)
- # reitit (8)
- # releases (1)
- # shadow-cljs (15)
- # squint (3)
- # xtdb (5)
In a clojure app using datomic I created the following malli schema:
(:import [datomic.db Db]))
(def DatomicDb (mc/-simple-schema {:type :datomic/db :pred (fn [v] (instance? Db v))}))
and that is working fine to validate a db instance.
I have a problem when using this type in a function schema - when there is an instrumentation failure the entire database is being serialized/printed in the instrument error. Is there a way to override how the pretty printer prints a certain type?oh, was pretty easy:
(:require [fipp.ednize :as ednize])
(extend-type datomic.db.Db
ednize/IOverride
ednize/IEdn
(-edn [x] ""))
can you provide an example, adding the :error
key to -simple-schema
has no effect.
The code path for the printer is (virhe/-visit)
invoked here https://github.com/metosin/malli/blob/9f5b8095e1bc72b04ce8c006ae8951b73a0afcf9/src/malli/dev/pretty.cljc#L54
which calls fipp.visit/visit
https://github.com/metosin/malli/blob/9f5b8095e1bc72b04ce8c006ae8951b73a0afcf9/src/malli/dev/virhe.cljc#L131
and I'm guessing it's hitting the unknown branch here:
https://github.com/metosin/malli/blob/9f5b8095e1bc72b04ce8c006ae8951b73a0afcf9/src/malli/dev/virhe.cljc#L44
which calls the protocol fn fipp.ednize/-edn