Skip to main content
Validity is two artifacts on Maven Central, under the group io.github.soleworks, released together and always at the same version: Most projects need only validity-core.

Add the dependency

For phone numbers, add validity-phone too, at the same version:
Validity is not on Maven Central yet: the first release is on its way. Until it lands, clone the repository next to your project and add includeBuild("../validity") to your settings.gradle.kts. Gradle then builds the dependency from the clone.

Requirements

Java 17+

The JVM the artifacts are compiled for.

Kotlin 2.4

The version Validity is built with. It uses context parameters for its DSL.

Coroutines

kotlinx.coroutines comes with validity-core. You do not need to add it.

Imports

The DSL lives in io.github.soleworks.validity, and the constraints in io.github.soleworks.validity.constraints. The constraints of a country have a package of their own, and the phone constraints live in the phone module:
Your IDE adds them for you when you complete a constraint.

Versions

Validity follows Semantic Versioning. While the version is 0.x, a breaking change raises the minor version, so moving to the next minor version may ask you to change your code. The changelog says what to change.

Next: validate your first class

Declare the rules of a class and read its violations.