Akkurate 0.10.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.9.0

ConstraintViolationSet.equals is now symmetric

The ConstraintViolationSet class implements the Set interface, but its implementation of the equals method was broken because it wasn't symmetric, like required by the specification.

This release fixes the bug, but it brings a breaking change:

fun compare( standardSet: Set<ConstraintViolation>, constraintViolationSet: ConstraintViolationSet ) { standardSet.equals(constraintViolationSet) // ✅ true constraintViolationSet.equals(standardSet) // ❌ false }
fun compare( standardSet: Set<ConstraintViolation>, constraintViolationSet: ConstraintViolationSet ) { standardSet.equals(constraintViolationSet) // ✅ true constraintViolationSet.equals(standardSet) // ✅ true }

The Validate annotation is now part of akkurate-core

The Validate annotation has been moved from the akkurate-ksp-plugin artifact to the akkurate-core one.

This is not a breaking change, but it means you can remove the implementation dependency to dev.nesk.akkurate:akkurate-ksp-plugin in your Gradle configuration:

dependencies { implementation("dev.nesk.akkurate:akkurate-core:0.8.0") implementation("dev.nesk.akkurate:akkurate-ksp-plugin:0.8.0") ksp("dev.nesk.akkurate:akkurate-ksp-plugin:0.8.0") }
dependencies { implementation("dev.nesk.akkurate:akkurate-core:0.9.0") ksp("dev.nesk.akkurate:akkurate-ksp-plugin:0.9.0") }

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: 24 September 2024