I have dto object with field of Boolean? type which is used in controller. Annotation @get:NotNull(message = "{err.test}") does not have any affect when I pass isCharity = null.
data class Human {
@get:NotNull(message = "{err.test}")
val isCharity: Boolean?
}
@RestController
internal class TestController {
@PutMapping
fun upsert(@RequestBody @Valid input: Human)...
}
Could you explain me why is that and how I can validate it?