Valar

0.6.0

Type-safe validation for Scala 3

A validation library for Scala 3 that derives validators from your types at compile time. The derivation uses inline macros and Mirror types to inspect case classes and generate validation code through the type system. If a field type is missing a validator, the compiler reports every missing one, names the fields, and tells you what to add. Validators compose in two modes: zip to collect all errors in one pass, flatMap to stop at the first. Errors are structured with field paths, so a failure in a nested object points to the exact location. Cross-compiles to JVM and Scala Native.

val user = (
  field("name", nonEmpty),
  field("age", between(0, 150)),
  field("email", matches(emailPattern))
).zip  // collects all errors in one pass

user.validate(input)
// Structured errors with field paths

Validators compose. Zip collects all errors, flatMap stops at the first.