Skip to content

Clarify that placing @Valid on the containers to validate container elements is discouraged #266

@marko-bekhta

Description

@marko-bekhta

Having the code as

@Valid
List<MyObject> strings

to apply cascading validation to the list elements is trailing from the BV 1.0 1.1 specs and in BV 2.0 the new way to define such constraints was introduced (using type argument annotations):

List<@Valid MyObject> strings

We should highlight to the users that applying cascading validation in a "legacy-way" will not be supported anymore in future versions of the spec, and that

@Valid
List<MyObject> strings

would mean that cascading validation is applied to the container itself (i.e. to the list and its properties) rather than its elements. Implementations of the current spec are encouraged to warn their users about this planned change and guide them to migrate to the correct way of achieving this through the usage of a type argument annotation

Things to also update:

Metadata

Metadata

Assignees

No one assigned

    Labels

    EE12Jakarta EE12 release related

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions