
Type-safe value-validation DSL offering declarative field checks, @Validatable annotation and annotation-based codegen that generates validate() extensions plus validator registry for automatic validation.
Type-safe value validation DSL for Kotlin Multiplatform.
:sure — KMP library (jvm, iosX64, iosArm64, iosSimulatorArm64). Core API: Validator<T>, ValidationScope, @Validatable,
built-in checks.:sure-ksp — KSP processor. Generates T.validate() extensions and validatorFor<T>() registry for every @Validatable class.@Validatable
data class LoginRequest(val username: String, val password: String) {
companion object {
val validator = Validator<LoginRequest> {
field(::username) { notBlank(); lengthIn(1..254) }
field(::password) { notBlank(); lengthIn(8..1024) }
}
}
}
LoginRequest("alice", "hunter22!").validate() // ValidationResult.ValidConsumer Gradle setup:
plugins {
alias(libs.plugins.ksp)
}
dependencies {
implementation("io.github.halotukozak:sure:0.1.0")
ksp("io.github.halotukozak:sure-ksp:0.1.0")
}Type-safe value validation DSL for Kotlin Multiplatform.
:sure — KMP library (jvm, iosX64, iosArm64, iosSimulatorArm64). Core API: Validator<T>, ValidationScope, @Validatable,
built-in checks.:sure-ksp — KSP processor. Generates T.validate() extensions and validatorFor<T>() registry for every @Validatable class.@Validatable
data class LoginRequest(val username: String, val password: String) {
companion object {
val validator = Validator<LoginRequest> {
field(::username) { notBlank(); lengthIn(1..254) }
field(::password) { notBlank(); lengthIn(8..1024) }
}
}
}
LoginRequest("alice", "hunter22!").validate() // ValidationResult.ValidConsumer Gradle setup:
plugins {
alias(libs.plugins.ksp)
}
dependencies {
implementation("io.github.halotukozak:sure:0.1.0")
ksp("io.github.halotukozak:sure-ksp:0.1.0")
}