This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-28
Channels
- # aleph (16)
- # announcements (7)
- # asami (4)
- # aws (26)
- # babashka (26)
- # babashka-sci-dev (50)
- # beginners (118)
- # biff (7)
- # calva (15)
- # cider (6)
- # clj-kondo (8)
- # cljs-experience (3)
- # clojure (30)
- # clojure-austin (26)
- # clojure-europe (20)
- # clojure-france (2)
- # clojure-ireland (1)
- # clojure-nl (3)
- # clojure-norway (2)
- # clojure-spec (7)
- # clojure-uk (6)
- # clojurescript (12)
- # community-development (5)
- # conjure (1)
- # copenhagen-clojurians (3)
- # core-typed (71)
- # cursive (3)
- # datomic (1)
- # emacs (4)
- # fulcro (2)
- # helix (2)
- # introduce-yourself (3)
- # jobs (1)
- # london-clojurians (6)
- # lsp (122)
- # malli (2)
- # missionary (5)
- # overtone (14)
- # pathom (4)
- # polylith (1)
- # reagent (4)
- # reitit (1)
- # releases (1)
- # shadow-cljs (80)
- # testing (10)
- # tools-deps (6)
- # vim (3)
- # xtdb (19)
the new pretty explainer seems to break cljs instrumentation, because of not found variables.
I am either missing something or I've found a bug. It seems like updating a key in a map-spec makes the the optional property have no effect, even though it is still there:
;;; Specification registry
(def registry
(atom {}))
(defn register! [type ?schema]
(swap! registry assoc type ?schema))
;; Combine the default registry with our own mutable registry.
(mreg/set-default-registry!
(mreg/composite-registry
(mreg/fast-registry (malli/default-schemas))
(mreg/mutable-registry registry)))
(register! :db/f
[:map
[:key {:optional true} [:double]]])
(register! :user/f
(-> (malli/deref :db/f)
(mutil/update :key #(mutil/update-properties % assoc :disabled true))))
(malli/deref :db/f)
;; => [:map [:key {:optional true} :double]]
(malli/deref :user/f)
;; => [:map [:key {:optional true} [:double {:disabled true}]]]
(malli/explain :db/f {})
;; => nil
(malli/explain :user/f {})
;; => {:schema :user/f, :value {}, :errors ({:path [0 :key], :in [:key], :schema [:map [:key {:optional true} [:double {:disabled true}]]], :value nil, :type :malli.core/missing-key})}
(mgen/sample :db/f)
;; => ({} {} {} {} {:key -1.5} {} {} {:key -1.09375} {:key -2.0} {:key 4.625})
(mgen/sample :user/f)
;; => ({:key -2.0} {:key -0.5} {:key 2.0} {:key -0.75} {:key -1.5} {:key 1.75} {:key 3.53125} {:key 1.25} {:key -0.25} {:key 0.271484375})
Yup, another user already found it: https://github.com/metosin/malli/issues/645