Without making a map totally closed, is there a way to assert that it doesn't contain one or more disallowed keys?
Is this an xyproblem? What are you trying to achieve?
that sounds like a valid usecase for things like disallowing deprecated keys, or as assistance when refactoring
you could also use [:and [:map ...] [:not [:map ...]]]
or, you could use an optional key with a never-valid schema
user=> (def exclude-keys
[:map
[:x :int]
[:y {:optional true} [:fn {:error/message {:en "disallowed key!"}} (constantly false)]]])
#'user/exclude-keys
user=> (m/validate exclude-keys {:x 1})
true
user=> (m/validate exclude-keys {:x 1 :y true})
false
user=> (m/validate exclude-keys {:x 1 :whatever true})
true
user=> (me/humanize (m/explain exclude-keys {:x 1 :y true}))
{:y ["disallowed key!"]}We might already have a better name for [:fn (constantly false)] but I don't remember what it is 😅
an [:not :any]
[:and ...] and [:fn ...]?