Fork me on GitHub
#clojure-spec
<
2019-10-06
>
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?

mpenet08:10:37

You can confirm this with (s/keys)