A container element constraint inside another container is not supported, and the failure surfaces
late: the processor only warns, no adapter is generated, and validation then throws at runtime.
Reproduction
@Valid
record Direct(List<List<@NotBlank String>> matrix) {}
Validator.instance().validate(new Direct(List.of(List.of("x", ""))));
Compile output
warning: No Constraints Defined
record Direct(List<List<@NotBlank String>> matrix) {}
No DirectValidationAdapter is generated.
Runtime
java.lang.IllegalArgumentException: No ValidationAdapter for class nest.Nest2$Direct
at io.avaje.validation.core.CoreAdapterBuilder.buildForType(CoreAdapterBuilder.java:83)
at io.avaje.validation.core.CoreAdapterBuilder.build(CoreAdapterBuilder.java:60)
at io.avaje.validation.core.DValidator.adapter(DValidator.java:151)
Expected
Either support the nested container element constraint, or fail the build with an error (not a
warning) so the missing adapter cannot reach production.
Comparison
- Hibernate Validator 9.1.2 validates
List<List<@NotBlank String>> and reports
grid[0].<list element>[1].<list element>.
- avaje
List<@NotBlank String> works (element violations reported, albeit with the malformed path
of Issue 3), and List<@Valid Inner> works and reports items[0].name.
A container element constraint inside another container is not supported, and the failure surfaces
late: the processor only warns, no adapter is generated, and validation then throws at runtime.
Reproduction
Compile output
No
DirectValidationAdapteris generated.Runtime
Expected
Either support the nested container element constraint, or fail the build with an error (not a
warning) so the missing adapter cannot reach production.
Comparison
List<List<@NotBlank String>>and reportsgrid[0].<list element>[1].<list element>.List<@NotBlank String>works (element violations reported, albeit with the malformed pathof Issue 3), and
List<@Valid Inner>works and reportsitems[0].name.