I'm trying to get Kotlin working with bean validation on spring-webflux project.
Requests seems to be validated properly, but message of a response body is empty, so it's difficult to know the cause of error.
Hot to get a default validation message from responses?
Controller:
class SomeController {
@PostMapping("/foo")
fun foo(@Valid @RequestBody body: FooRequest): Mono<FooRequest> {
return Mono.just(body)
}
}
Request:
data class FooRequest(
@field:Min(0)
val bar: Int
)
The response of calling that api with the request "{\"bar\":-1}" is
{
"timestamp": "2021-03-23T02:18:49.368+00:00",
"path": "/api/v1/foo",
"status": 400,
"error": "Bad Request",
"message": "",
"requestId": "d1739c79-6"
}