Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[bean-validation-dev] Proposed usage of @Valid by Jakarta Data specification

Hi, I'd like to check with the Jakarta Bean Validation specification group on a proposed usage of the jakarta.validation.Valid annotation for Jakarta Data.  As discussed in our issue 216, we are looking for a way to allow users to opt in to automatic validation of entities when saved via Jakarta Data repositories.  The most straightforward way for users to ask for this is to standardize the approach that existing vendors (such as Micronaut) are already using, which is that users opt in by placing the Valid annotation on the entity parameter of the repository, as follows,

 

@Repository

public interface School extends PageableRepository<@Valid Student, String> {

}

 

Because this differs somewhat from the intended purpose of the Valid annotation, I’d like to check with the Jakarta Bean Validation specification group on whether you would find this usage/overloading acceptable before defining this pattern in the Jakarta Data specification.  There are other ways we could define the ability to opt in in Jakarta Data, but this one is preferable if you find it acceptable because it matches what implementations are already doing.  Let me know what your thoughts are.


Back to the top