Fork me on GitHub
#clojure-spec
<
2022-12-21
>
vemv13:12:07

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)

vemv13:12:34

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)13:12:13

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

Alex Miller (Clojure team)13:12:17

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

👀 1
vemv14:12:24

> 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)15:12:04

I think so? can't remember