commonMain.io.konform.validation.Validation.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of konform-jvm Show documentation
Show all versions of konform-jvm Show documentation
Konform: Portable validations for Kotlin
package io.konform.validation
import io.konform.validation.internal.ValidationBuilderImpl
public interface Validation {
public companion object {
public operator fun invoke(init: ValidationBuilder.() -> Unit): Validation {
val builder = ValidationBuilderImpl()
return builder.apply(init).build()
}
}
public fun validate(value: T): ValidationResult
public operator fun invoke(value: T): ValidationResult = validate(value)
}
public class Constraint internal constructor(
public val hint: String,
public val templateValues: List,
public val test: (R) -> Boolean,
)