hho
11/06/2026, 12:19 PMimport jakarta.validation.constraints.Size;
import java.util.List;
public record UploadRequestJ(
@Size(min = 1, message = "Must provide checksums")
List<@Size(min = 1, message = "Checksum can't be empty") String> checksums
) {}
but doesn’t in Kotlin:
import jakarta.validation.constraints.Size
data class UploadRequestKt(
@get:Size(min = 1, message = "Must provide checksums")
val checksums: List<@Size(min = 1, message = "Checksum can't be empty") String>
)
The string length isn’t checked when using the Kotlin version.
Is there a workaround?Johan
11/06/2026, 12:55 PMcompilerOptions {
...
// Emit TYPE_USE annotations (e.g. List<@Valid Foo>) into the bytecode so Bean Validation
// can cascade into container elements. Without this Kotlin silently drops them.
freeCompilerArgs.add("-Xemit-jvm-type-annotations")
}hho
11/06/2026, 1:00 PMhho
11/06/2026, 1:00 PMhho
11/13/2026, 10:42 AM