This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-29
Channels
- # beginners (1)
- # cider (7)
- # cljsrn (6)
- # clojars (3)
- # clojure (35)
- # clojure-nl (2)
- # clojure-spec (5)
- # clojure-uk (9)
- # clojurescript (18)
- # clojurex (1)
- # community-development (2)
- # cursive (27)
- # datomic (12)
- # duct (11)
- # emacs (5)
- # hoplon (5)
- # immutant (2)
- # leiningen (1)
- # luminus (15)
- # nyc (1)
- # om (9)
- # om-next (5)
- # onyx (55)
- # parinfer (1)
- # re-frame (3)
- # reagent (44)
- # reitit (11)
- # ring-swagger (4)
- # shadow-cljs (25)
- # videos (1)
Hi! I would like to spec a map where the values have to conform to some spec, but the fields can be arbitrary. How do I do that?
Use s/map-of and any?
Thanks, that works! This was the first time with Spec for me and the original code I modified was using cat
, which was confusing me.
@alexmiller s/cat
also matches maps, is that correct? So I need to get the ordering right to make s/map-of
match first / instead of s/cat
?
I came up with this, which appears to work (and passes tests), but I'll have to read more about spec to be sure: https://github.com/devurandom/venia/commit/31d0a15a28f4a20c9355f7d452f7b2b430f2ff16#diff-c1f178afedb93b23e615114ff149605d