Akkurate 0.7.0 Help

Migration guide

Some breaking changes might happen sometimes, especially until Akkurate reaches its first stable version. Here you can find how to migrate to a new version containing breaking changes.

Version 0.7.0

Akkurate improved its DSL by implementing scope control, which means you can no longer implicitly reference a declaration of an outer receiver:

@Validate data class Book(val title: String, val labels: List<String>) val validateBook = Validator<Book> { title.isNotBlank() labels { each { isNotBlank() hasSizeLowerThan(10) // ❌ Compiler error: 'hasSizeLowerThan' can't be called // in this context by implicit receiver. Use the explicit // one if necessary. // 💬 It happens because 'hasSizeLowerThan' is implicitly // applied to the 'labels' property. } } }
@Validate data class Book(val title: String, val labels: List<String>) val validateBook = Validator<Book> { title.isNotBlank() labels { hasSizeLowerThan(10) // ✅ Success: 'hasSizeLowerThan' is explicitly applied to the // 'labels' property. each { isNotBlank() } } }

Version 0.4.0

The Configuration declaration is no longer a data class. To create a new configuration, use the following builder DSL:

Configuration { defaultViolationMessage = "The field contains an invalid value" rootPath("custom", "root", "path") }
Configuration( defaultViolationMessage = "The field contains an invalid value", rootPath = listOf("custom", "root", "path"), )
Last modified: 27 February 2024