Am I correct in understanding that :opt keys in a :keys spec are basically just informational? Given that all keys are validated if they have associated specs and maps are open, it seems that (technically) every key is an optional key
Is it considered an undefined behavior? Or is it the actual guarantee?
Like could we expect the behavior to change in the future and be an implementation detail?
For what?
I assume guarantee since the spec guide on the website says: > When conformance is checked on a map, it does two things - checking that the required attributes are included, and checking that every registered key has a conforming value. We’ll see later where optional attributes can be useful. Also note that ALL attributes are checked via keys, not just those listed in the :req and :opt keys. Thus a bare (s/keys) is valid and will check all attributes of a map without checking which keys are required or optional.
That s/keys loops over all keys to validate their values, and not just the ones declared in req and opt.
Interesting, I never noticed you could just define a bare s/keys to validate values of specced keys.
it's guaranteed and discussed in the docstring
Normally you also define specs for the values. Then you need :opt .
Value specs are checked for all keys, regardless of whether in req or opt