News for hackers. Stuff that matters.
Re:What Clojure Spec is and what you can do with it by jwr on Thursday September 10, 2020 @04:01PM (#24435985)
> Thus if you have a map without the key, the value won't be validated. But if the key is present, then it will validate its value.

Exactly. Which is something I did not expect. I expected '(s/valid? ::my-spec x)' to tell me if x is valid according to ::my-spec, checking only those keys that ::my-spec lists in :req and :opt (if present).

For maps, you might as well think of s/valid? as ignoring the first parameter. It validates anything it can.

Re:What Clojure Spec is and what you can do with it by didibus on Friday September 11, 2020 @02:16AM (#24439691)
Oh, you mean because it will validate even qualified keys that arn't defined on req and opt if they have a corresponding spec?

I admit, that's surprising. Not sure why they made it so.