I'm have kotlin get request. Validation are not working, Possible to specify day of week more or less validate limits
@RestController
@Validated
open class GetCrab {
@GetMapping("/v1/get")
open fun getNameOfDayByNumber(@RequestParam dayOfWeek: @Min(1) @Max(7) Int?): String {
return "ok"
}
}
In the same java code validation works
@RestController
@Validated
public class GetCrab {
@GetMapping("/v1/get")
public String getNameOfDayByNumber(@RequestParam @Min(1) @Max(7) Integer dayOfWeek) {
return "ok";
}
}
Java code when validation works: request:
http://localhost:12722/v1/get?dayOfWeek=100
Response ->
{
"errors": [
{
"code": "INTERNAL_SERVER_ERROR",
"details": "getNameOfDayByNumber.dayOfWeek: must be less than or equal to 7"
}
]
}
Kotlin code, request http://localhost:12722/v1/get?dayOfWeek=100
Response:
ok