This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-06
Channels
- # announcements (69)
- # aws-lambda (3)
- # babashka (45)
- # beginners (29)
- # calva (4)
- # clara (7)
- # clojure (23)
- # clojure-spec (5)
- # clojure-uk (18)
- # clojurescript (57)
- # clojutre (1)
- # cursive (20)
- # datomic (31)
- # emacs (5)
- # figwheel-main (3)
- # fulcro (16)
- # graalvm (7)
- # luminus (4)
- # nrepl (9)
- # off-topic (53)
- # re-frame (8)
- # reitit (2)
- # rewrite-clj (10)
- # shadow-cljs (88)
- # spacemacs (1)
- # sql (8)
- # vim (2)
seancorfield00:10:40
@roklenarcic If you have a spec :foo/bar
and you conform any map that contains :foo/bar
, it will get checked
spec.demo=> (s/def :foo/bar int?)
:foo/bar
spec.demo=> (s/conform (s/keys) {:foo/bar "x"})
:clojure.spec.alpha/invalid
spec.demo=> (s/conform (s/keys) {:foo/bar 42})
#:foo{:bar 42}
spec.demo=>
seancorfield00:10:41
So the s/merge
with the unnamespaced key doesn't get conformed because s/merge
only conforms the last spec -- ::b
-- but the qualified keys all get conformed because regardless of whether they're even in the spec.
roklenarcic08:10:29
wait, so namespaced keys in maps get checks even if they are not in the spec I'm using to check them with?