title: Spring Rest API validation should be in DTO or in entity?
body: <p>In which tier should the validation be in a Spring Boot Rest API. I have some models, endpoints and DTOs. I added some <code>@NotNull</code> and <code>@Size</code> annotations in the DTO. I added the <code>@Valid</code> annotation in the endpoint along with the <code>@RequestParam</code> annotation. </p>
  
  <p>But now I'm wondering if I should put validation in the <code>@Entity</code> classes as well? I feel like it would be a duplication of code. But I read that a tier should never rely on another one.</p>