I stumbled upon this behavior, which I found a bit weird.
(s/def :sequence-list/eid number?)
(s/valid?
(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?yes
s/keys will check all registered keys in the map
so even (s/keys)
is a spec that does things
interesting, thanks 🙂
this is covered if you (doc s/keys)
or look at the spec guide https://clojure.org/guides/spec
> > 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.
^^
yeah says so in docstring 🙂