Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Method protected void processConstraintViolations of Spring Validator Adaptor Public [SPR-17339] #21873

spring-projects-issues opened this issue Oct 4, 2018 · 2 comments
in: web status: declined


Copy link

@spring-projects-issues spring-projects-issues commented Oct 4, 2018

Ankur Pathak opened SPR-17339 and commented

This method of SpringValidatorAdaptor should be public or their should be some similar public interface:

protected void processConstraintViolations(Set<ConstraintViolation<Object>> violations, Errors errors) {}

It allows to convert Set<ConstraintViolation> to BindingResult(BindException). So it has pottential of being used outside spring framework may be jax-rs, jax-ws in following manner:

  1. We can validate the bean using bean validation api.
  2. Convert Set<ContraintViolations> to BindingResult using above method
  3. Use that binding result to report good validation messages in any rest or soap java web api frmeaork.

Making that method protected is conflicting with above use case. Or we can have similar pblic interface to convert Ser<ConstrainViolation> to BindingResult.

Even some api framework like jax-ws jesey  have integration for bean validation api and through constraintvoilationexception. this exception has set<constrainviolations>. Right now we don;t have any interface in LocalValidatorFactory to convert it to bindingresult. The advantage bindingresult

has is by using it we can easily prepare validation errors for user in any framework.

Affects: 5.0.9, 5.1 GA

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 4, 2018

Ankur Pathak commented

Here is a repository where I am trying to do so for Jersey(Jersey On Spring Boot):

You can specially have a look at ValidationExceptionMapper and ConstraintViolationExceptionMapper.

@spring-projects-issues spring-projects-issues added status: waiting-for-triage type: enhancement in: web and removed type: enhancement labels Jan 11, 2019
Copy link

@rstoyanchev rstoyanchev commented Jan 8, 2021

The goal for this component is purely to adapt Standard Validation as a Spring Validator so it can be configured within Spring infrastructure. It is not a good fit for and not a goal to support its use within other frameworks.

@rstoyanchev rstoyanchev added status: declined and removed status: waiting-for-triage labels Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: web status: declined
None yet

No branches or pull requests

2 participants