clojure - How can I only use conforming values of a map? -
in forbidden keys in clojure.spec, accepted answer states can't forbid keys because should ignore values you're not interested.
however, there way map, containing keys validated , specced?
(s/def ::category (s/keys :req-un [::name ::description])) (s/conform ::category {:name "hugo" :description "asdf" :other 1})
gives me
{:name "hugo", :description "asdf", :other 1}
but i'd get
{:name "hugo", :description "asdf"}
of course don't want specify keys twice, defeat purpose. want make sure noone later uses keys aren't specced.
Comments
Post a Comment