satisfy

fun <V : Any> ObjectRuleBuilder<V>.satisfy(predicate: V.() -> Boolean, message: () -> String)

Validates that the object value passes the given predicate.

Usage:

rules<Post> {
satisfy({ title.isNotBlank() }) { "Title must be not blank" }
}

Parameters

predicate

The predicate to test the object value. Returns true if the test passes; false otherwise.

message

The message to return when the test fails.