Am I doing something wrong here? The validation ne...
# spring
b
Am I doing something wrong here? The validation never seems to get called.
Copy code
@RestController
class TestController {
    @PostMapping
    fun testValidation(@Valid @RequestBody validRequest: ValidRequest): ResponseEntity<String> {
        // Should not be here
        return ok().body(validRequest.item)
    }
}

data class ValidRequest(
        @Email
        val item: String
)
Here is the request:
Copy code
POST <http://localhost:8080>
Content-Type: application/json

{
  "item": ""
}