micronaut-projects / micronaut-projects/micronaut-validation
No validation performed with `@Repeatable` annotations used more than once for the same element
- Dominant language
- Java
- Stars
- 9
- Forks
- 8
- Avg merge
- 20h 7m
- Merged PRs (30d)
- 9
Description
Hi guys, I'm having issues when using `@Repeatable` constraint annotations with `micronaut-validation`. When I add more than one of the same annotation to a field/class, no validation is performed. In other validation frameworks, like hibernate validator, they work normally. I created a minimal project that reproduces the issue in the tests: https://github.com/racevedoo/micronaut-validation-test
In this project, there are 2 objects that are validated, one contains a field with a single `@Pattern` constraint (`PatternValidation`), and other with multiple `@Pattern` constraints for the same field (`PatternValidationMultipleAnnotations`). I know the pattern annotation is not the best example, but for custom annotations it's quite common to annotate the same element multiple times with the same annotation (with different annotation parameters).
Is this a bug?
### Task List
- [x] Steps to reproduce provided
- [x] Example that reproduces the problem uploaded to Github
- [x] Full description of the issue provided (see below)
### Steps to Reproduce
1. Run the following [test](https://github.com/racevedoo/micronaut-validation-test/blob/main/src/test/java/mn/validation/PatternValidationMultipleAnnotationsTest.java)
### Expected Behaviour
The test should pass, as the object has constraint violations.
### Actual Behaviour
The test does not pass, because no validation is performed.
### Environment Information
- **Operating System**: Linux Fedora 32
- **Micronaut Version:** 2.2.3
- **JDK Version:**
```
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9.1+1)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9.1+1, mixed mode)
```
### Example Application
https://github.com/racevedoo/micronaut-validation-test
Contributor guide
Research direction
Run the reproduction test in src/test/java/mn/validation/PatternValidationMultipleAnnotationsTest.java from the linked example project, comparing it with PatternValidation. Trace how micronaut-validation handles repeated @Pattern annotations and verify that the multiple-annotation case produces the expected constraint violations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100