Seems like that's the reasonable place to check it, otherwise you're forced into an ordering for your specs and cannot write recursive strict map specs.
On Wednesday, October 4, 2017 at 8:59:59 AM UTC-7, Yuri Govorushchenko wrote: > > Thanks. This approach is also different from the macro because it will > check specs existence at the validation time, not at the s/def call. > > On Wednesday, October 4, 2017 at 4:18:16 PM UTC+3, Moritz Ulrich wrote: >> >> Yuri Govorushchenko <yuri....@gmail.com> writes: >> >> > Thank you the pointers! So far I ended up with writing a small `map` >> macro >> > which is similar to `s/keys` but checks that keys are already in the >> > registry: >> https://gist.github.com/metametadata/5f600e20e0e9b0ce6bce146c6db429e2 >> >> Note that you can simply combine a custom predicate and `s/keys` in >> clojure.spec to verify that all keys in a given map have a underlying >> spec: >> >> ``` >> (s/def ::whatever (s/and (s/keys ...) >> #(every? keyword? (keys %)) >> #(every? (comp boolean s/get-spec) (keys %)) ) >> ``` >> > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.