Getting started

This section helps you set up Spine Validation, define your first validated Protobuf model, and see validation in action in Java and Kotlin.

If you are new to the library, read the short overview first:

What you’ll learn 

  • How to add Spine Validation to a JVM project using Gradle plugins.
  • How to declare validation rules in .proto files.
  • How validation is enforced at runtime.

Prerequisites 

  • Java 17+
  • Gradle (Kotlin DSL or Groovy)
  • Optional: Kotlin 2.2.21+ for the Kotlin Protobuf DSL

If your project already generates Java/Kotlin sources from .proto files, you’re 90% there. Spine Validation integrates into the build to generate and inject validation logic into the code produced by protoc.

Code samples in this tutorial use Google Truth and Kotest Assertions.

Quick path 

  1. Add Validation to your build
  2. Define constraints in .proto files
  3. Build your project
  4. Use the generated validation API

What’s next