This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-22
Channels
- # ai (1)
- # announcements (1)
- # babashka (9)
- # beginners (18)
- # calva (19)
- # clerk (136)
- # clj-http (3)
- # clj-kondo (13)
- # cljs-dev (166)
- # clojure (39)
- # clojure-europe (133)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (12)
- # clr (1)
- # community-development (6)
- # conjure (8)
- # cursive (13)
- # data-science (1)
- # datomic (26)
- # events (5)
- # fulcro (12)
- # gratitude (3)
- # honeysql (9)
- # hyperfiddle (33)
- # introduce-yourself (6)
- # kaocha (1)
- # lambdaisland (5)
- # malli (4)
- # off-topic (3)
- # rdf (4)
- # re-frame (3)
- # releases (3)
- # scittle (11)
- # specter (2)
- # sql (4)
- # tools-deps (4)
- # vim (10)
Is there a schema for maps whose keys are all namespace qualified to a specific namespace? I don’t want to type out the same namespace N times, so that disqualifies something like`[:and [:fn (fn [m] (every? (comp (partial = "ns") namespace) (keys m)))] [:map …]]`
Don't think there's such a schema but you can write a schema transformer function that accepts [:map [:a int?] [:b string?]]
along with :my-ns
and spits out [:map [:my-ns/a int?] [:my-ns/b string?]]
.
> I don’t want to type out the same namespace N times
You can also use namespace aliases to alleviate the issue a bit.
Another option would be to use malli.experimental.lite/schema
:
(malli.experimental.lite/schema #:some-ns{:a int?, :b string?})
=> [:map [:some-ns/a int?] [:some-ns/b string?]]