Fork me on GitHub
Dmytro Bunin15:11:29

I stumbled upon this behavior, which I found a bit weird.

(s/def :sequence-list/eid number?)
 (s/keys :opt []) ;; ⇠ no reference to :sequence-list/eid
 (merge #:entity {:label "foo"}
        #:sequence-list {:eid "sample"}))
=> false
does the s/keys look at global registry in some way?

Alex Miller (Clojure team)15:11:58

s/keys will check all registered keys in the map

Alex Miller (Clojure team)15:11:21

so even (s/keys) is a spec that does things

Dmytro Bunin15:11:05

interesting, thanks 🙂

Alex Miller (Clojure team)15:11:46

this is covered if you (doc s/keys) or look at the spec guide

Dmytro Bunin15:11:48

> > In addition, the values of all namespace-qualified keys will be validated > (and possibly destructured) by any registered specs. Note: there is > no support for inline value specification, by design.

Dmytro Bunin15:11:58

yeah says so in docstring 🙂