This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-07
Channels
- # announcements (32)
- # asami (1)
- # babashka (127)
- # beginners (135)
- # bristol-clojurians (1)
- # calva (21)
- # chlorine-clover (5)
- # cider (2)
- # clara (9)
- # clj-kondo (24)
- # cljsrn (2)
- # clojure (25)
- # clojure-australia (4)
- # clojure-europe (135)
- # clojure-nl (8)
- # clojure-russia (3)
- # clojure-spec (4)
- # clojure-uk (9)
- # clojurescript (55)
- # cursive (6)
- # datomic (62)
- # events (1)
- # fulcro (1)
- # helix (19)
- # jobs (3)
- # jobs-rus (1)
- # kaocha (8)
- # malli (6)
- # meander (3)
- # off-topic (2)
- # pathom (3)
- # podcasts (1)
- # polylith (3)
- # practicalli (3)
- # re-frame (4)
- # reitit (5)
- # remote-jobs (1)
- # reveal (1)
- # rewrite-clj (9)
- # ring-swagger (1)
- # shadow-cljs (59)
- # xtdb (4)
is there a way I can set all map schema :closed by default? so that don't need to specify individually.
I don't think there is, however, you could gather up all your schemas and map over them with malli.utils/closed-schema
to recursively close them.
👌 2
You could copy the -map-schema
definition and make your own -closed-map-schema
https://github.com/metosin/malli/blob/master/src/malli/core.cljc#L616
so you could write:
[:closed-map [:xyz string?]]
not sure if that's worth it vs just typing {:closed true}
though
👍 2
@siddharthjain.in or better: create a PR that allows m/-map-schema
to take :closed
and then say:
(m/-map-schema {:naked-keys true, :closed true})
.. and you have a closed variant.🕶️ 2
👌 2