isContainingKey

fun <K> Validatable<Map<out K, *>?>.isContainingKey(key: K): Constraint

The validatable Map must contain the provided key when this constraint is applied.

Code example:

val validate = Validator<Map<Char, Int>> { isContainingKey('b') }
validate(mapOf('a' to 1, 'b' to 2, 'c' to 3)) // Success
validate(emptyMap()) // Failure (message: Must contain key "b")