eclipse-ee4j / eclipse-ee4j/jersey
Validation errors path doesn't take into account names in JAX-RS annotations and Jackson annotations
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
Currently ValidationHelper translates path in ConstraintViolation almost as is.
So you get something like:
`AccountResource.create.arg0.country`
For
```
@Path("account")
@Produces(MediaType.APPLICATION_JSON)
public class AccountResource {
@POST
public Response create(@Valid CreateAccountRequest request) {
return Response.ok().build();
}
}
public class CreateAccountRequest {
@NotNull
@JsonProperty("originCountry")
private String country;
//...
}
```
For a more approachable path would have been:
`originCountry`
Since it's the entity is in the body, so it's the only path you care about from the perspective of the client sending the request and getting this error.
It seems that DropWizard project has done some good work on top of Jersey, which could be taken into Jersey. See: http://www.dropwizard.io/0.9.0/docs/manual/validation.html
It can with turned on with configuration.
Contributor guide
Assessment
This issue has not been assessed yet.