Fork me on GitHub
#clojure-spec
<
2017-06-02
>
danielneal07:06:40

@alexmiller great! Yeah spec'd specs would be exactly the thing for that - would make it much easier to write a deep describe

xiongtx22:06:39

Is spec supposed to treat undefined keys as “any”?

(s/def ::foo
  (s/keys :req-un [::x ::y ::z]))    ;; x, y, z undefined

(s/valid? ::foo {:x 1 :y "abc" :z clj-uuid/+null+})    ;; => true

english23:06:29

@xiongtx for s/keys, yes. Presence of the key will always be checked when using req and req-un, but conformance is checked only if specs are registered with the same keys

xiongtx23:06:48

Is that a design decision or just an implementation detail?

xiongtx23:06:37

B/c that seems like it opens the possibility of forgetting to define a key spec and s/valid? still passing in tests