Package-level declarations

Types

Link copied to clipboard
open class CompoundValidators<P>(label: String) : Validators<P>
Link copied to clipboard
data class Invalid<out T>(val value: T, val reasons: List<String>) : Validity<T>
Link copied to clipboard
class PropertyValidators<P, C>(label: String, val parent: CompoundValidators<P>, val nested: CompoundValidators<P>?, val property: KProperty1<P, C>) : Validators<C>
Link copied to clipboard
data class Valid<out T>(val value: T) : Validity<T>
Link copied to clipboard
typealias ValidationFactory<R> = Validators<R>.() -> Validator<R>
Link copied to clipboard
interface Validator<in T>
Link copied to clipboard
open class Validators<T>(val label: String)
Link copied to clipboard
interface Validity<out T>

Properties

Link copied to clipboard
Link copied to clipboard
val <T : String?> Validator<T>.max: Int?
Link copied to clipboard
val <T : String?> Validator<T>.min: Int?
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun <T> Collection<Validity<*>>.aggregate(value: T): Validity<T>
Link copied to clipboard
fun <T, V : Validators<T>> V.append(key: String, validator: (T & Any) -> Validity<T>): V
fun <T, D, V : Validators<T>> V.append(key: String, metadata: D, validator: (T & Any) -> Validity<T>): V
Link copied to clipboard
fun <T, V : Validators<T>> V.check(message: (T & Any) -> String = { "Did not pass the check validation" }, predicate: (T & Any) -> Boolean): V
Link copied to clipboard
fun <T> custom(label: String): Validators<T>
Link copied to clipboard
fun <T, V : Validators<T>> V.execute(function: (T & Any) -> Validity<T>): V
Link copied to clipboard
inline fun Validator<*>.int(key: String): Int?
Link copied to clipboard
fun <T : String?, V : Validators<T>> V.length(value: Int, message: (value: String) -> String = { "$label should have $value character(s), but has ${it.length} character(s) instead" }): V
Link copied to clipboard
fun <T : String?, V : Validators<T>> V.max(value: Int, message: (String) -> String = { "$label should have less than $value character(s), but has ${it.length} character(s) instead" }): V
Link copied to clipboard
fun <T : String?, V : Validators<T>> V.min(value: Int, message: (String) -> String = { "$label should have more than $value character(s), but has ${it.length} character(s) instead" }): V
Link copied to clipboard
fun <T : String?, V : Validators<T>> V.notBlank(message: (String) -> String = { "$label is required to not be empty but it was" }): V
Link copied to clipboard
fun <P, C : Any> PropertyValidators<P, C>.required(message: String = " is required, but was null"): Validator<C>
fun <T> Validators<T>.required(message: String = " is required, but was null"): Validator<T>
Link copied to clipboard
fun <T> Validator<T>.root(key: String): ValidatingFunction<*, *>?
Link copied to clipboard
inline fun <T> Validator<T>.set(builder: Validator<T>.() -> Validator<T>): Validator<T>
Link copied to clipboard
fun string(label: String = "unnamed"): Validators<String>
fun <T> string(name: KProperty<T>): Validators<T>
Link copied to clipboard
fun <T> validator(label: String): Validators<T>