My understanding is that spec/keys works for validating specific keys in a hash-map. However, I need it to also reject a hash-map that contains keys that are not in :req and :opt.
For a contrived example, imagine I have a definition of a person as an edn:
The spec could be:
(spec/def ::name string?)
(spec/def ::age int?)
(spec/def ::person (spec/keys :req-un [::name ::age]))
The above definition would conform to this ::person spec.
However, let's say that, due to a confusion by a developer, another key unrelated to a Person's definition was added, and the hash-map is now:
That would still conform to the spec. But I want it to fail!
Is there a simple way to make spec/keys reject a hash-map that has keys that are neither req nor opt?