rootPath

fun rootPath(vararg pathSegments: String)

Defines the root path.


open override var rootPath: Path

A root path prefixing all paths available in constraint violations.

By default, the root path is empty:

@Validate
data class Book(val title: String)

Validator<Book> {
title.length.isGreaterThan(0) // Path: [title, length]
}

When non-empty, the root path is prefixing all the paths:

val config = Configuration {
rootPath("book")
}

Validator<Book>(config) {
title.length.isGreaterThan(0) // Path: [book, title, length]
}