rootPath
Defines the root 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]
}
Content copied to clipboard
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]
}
Content copied to clipboard