This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-05
Channels
- # announcements (14)
- # babashka (51)
- # beginners (154)
- # calva (24)
- # cider (4)
- # clj-kondo (24)
- # cljfx (11)
- # cljs-dev (3)
- # clojure (259)
- # clojure-europe (14)
- # clojure-nl (2)
- # clojure-seattle (8)
- # clojure-spec (6)
- # clojure-taiwan (1)
- # clojure-uk (52)
- # clojurescript (123)
- # conjure (43)
- # core-async (15)
- # datomic (14)
- # events (1)
- # fulcro (90)
- # helix (7)
- # jobs (6)
- # meander (10)
- # nrepl (1)
- # off-topic (13)
- # pathom (1)
- # portal (8)
- # re-frame (7)
- # reveal (11)
- # shadow-cljs (99)
- # spacemacs (11)
- # testing (11)
- # vim (63)
is it possible to write specs for maps like you can in schema?
(def User
{::id s/Int
::name s/Str})
vs
(s/def ::id int?)
(s/def ::name string?)
(s/def ::user
(s/keys :req [::id ::name]))
that is how you do it in spec
no, there is a philosophical difference in approach here
spec is trying to build a registry of spec'ed attributes. the attributes are seen as primary, the map only as container.
9
spec 2 is developing this further and will have some support for unqualified attributes with inline specs in a schema
🆒 3