isContainingKey
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")
Content copied to clipboard