Move @Valid from the container to its element type

MSAL

Hibernate Validator 9.1 deprecates requesting cascaded validation at the container level, and warns while building the metadata for declarations such as @Valid List<Order> orders. Rewrites those to the type argument form List<@Valid Order> orders that has been available since Bean Validation 2.0. The element type argument is annotated for Iterable and Optional containers, and the value type argument for Map, matching where the built-in value extractors cascade to. @Valid on anything other than one of those containers is left alone, as are wildcard, raw and array type arguments.

org.openrewrite.hibernate.validator.MoveValidToContainerElement
mod run . --recipe=org.openrewrite.hibernate.validator.MoveValidToContainerElement

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.