clojure-spec

vemv 2022-12-21T13:53:07.505259Z

https://clojure.org/guides/spec#_entity_maps says: > Also note that ALL attributes are checked via keys, not just those listed in the :req and :opt keys. I'm curious, does this behavior also exist in spec2? (I never invested time in spec2 at all as it's still wip)

vemv 2022-12-21T13:55:34.506519Z

The broader question that prompted me to ask this is: is such behavior a universally good idea? I have no opinion from my side. I don't recall it ever bothering me. Perhaps there's the performance/security consideration of checking unforeseen keys? I wouldn't mind about that either given that I can remove extraneous keys at the edges (with some or other approach - there are a few)

Alex Miller (Clojure team) 2022-12-21T13:58:13.858389Z

yes, it exists, although s/keys is really deprecated in favor of schema/select in spec 2

Alex Miller (Clojure team) 2022-12-21T13:59:17.407129Z

but there is also the notion of closed spec checking which limits things somewhat (and plumbing to add other such options during checking)

👀 1
vemv 2022-12-21T14:02:24.215409Z

> yes, it exists, although s/keys is really deprecated in favor of schema/select in spec 2 So it also exists when using select in a vanilla fashion, right?

Alex Miller (Clojure team) 2022-12-21T15:20:04.388559Z

I think so? can't remember