
Simplifies data validation with a declarative style, supporting custom error types and validation context. Offers features like email, check digit, and password strength validations.
How often have you written validations on untrusted data? The bulk of these validations were pretty simple, but
repetitive; if (!condition) { create error }. This pattern gets tiresome really quickly. Things get
worse if you want to eagerly validate many fields.
No more!
Using Konfork's declarative style, you can simply write things like:
val validateUser = Validator<UserProfile> {
UserProfile::fullName {
minLength(2)
maxLength(100)
}
UserProfile::age ifPresent {
minimum(0)
maximum(150)
}
}Note that this is a newly forked project. Because of this I expect the API to be unstable the first couple of versions.
For multiplatform projects:
kotlin {
sourceSets {
commonMain {
dependencies {
implementation("io.github.konfork:konfork-core:${konforkVersion}")
}
}
}
}
For jvm-only projects add:
dependencies {
implementation("io.github.konfork:konfork-core-jvm:${konforkVersion}")
}
Konfork is a fork of Konform. While Konform is an excellent project there were two big features missing:
Besides this, the design philosophy was to not add a series of default validations (e.g. isUuid() or isEmail()).
This projects aim is to add these features.
How often have you written validations on untrusted data? The bulk of these validations were pretty simple, but
repetitive; if (!condition) { create error }. This pattern gets tiresome really quickly. Things get
worse if you want to eagerly validate many fields.
No more!
Using Konfork's declarative style, you can simply write things like:
val validateUser = Validator<UserProfile> {
UserProfile::fullName {
minLength(2)
maxLength(100)
}
UserProfile::age ifPresent {
minimum(0)
maximum(150)
}
}Note that this is a newly forked project. Because of this I expect the API to be unstable the first couple of versions.
For multiplatform projects:
kotlin {
sourceSets {
commonMain {
dependencies {
implementation("io.github.konfork:konfork-core:${konforkVersion}")
}
}
}
}
For jvm-only projects add:
dependencies {
implementation("io.github.konfork:konfork-core-jvm:${konforkVersion}")
}
Konfork is a fork of Konform. While Konform is an excellent project there were two big features missing:
Besides this, the design philosophy was to not add a series of default validations (e.g. isUuid() or isEmail()).
This projects aim is to add these features.