eclipse-ee4j / eclipse-ee4j/jersey
@ValidateOnExecution is ignored for resource field validation
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
I just ran into the following issue with Glassfish 5.0 b25:
Given the following resource class:
```java
@Path("/hello")
@ValidateOnExecution(type = ExecutableType.NONE)
public class HelloResource {
@QueryParam("a")
@Min(10)
private int a;
@GET
public String get(@QueryParam("b") @Min(10) int b) {
// ....
}
}
```
So basically there are two query parameters both annotated with Bean Validation annotation `@Min(10)`. But validation is disabled using `@ValidateOnExecution` on the class level.
In this case submitting an invalid value for parameter `b` works fine and the resource method is invoked as expected. However, if you submit an invalid value for parameter `a`, the value is still validated and the server responds with a 400 status code. IMO that's a bug.
BTW: The bug also occurs if I disable validation via `@ValidateOnExecution` on the controller method or globally via `META-INF/validation.xml`.
Contributor guide
Assessment
This issue has not been assessed yet.