Class ConstraintViolationHandler

java.lang.Object
io.jooby.hibernate.validator.ConstraintViolationHandler
All Implemented Interfaces:
ErrorHandler

public class ConstraintViolationHandler extends Object implements ErrorHandler
Catches and transform ConstraintViolationException into ValidationResult

Payload example:


 {
    "title": "Validation failed",
    "status": 422,
    "errors": [
       {
          "field": null,
          "messages": [
             "Passwords should match"
          ],
          "type": "GLOBAL"
       },
       {
          "field": "firstName",
          "messages": [
             "must not be empty",
             "must not be null"
          ],
          "type": "FIELD"
       }
    ]
 }
 
Since:
3.3.1
Author:
kliushnichenko
  • Constructor Details

    • ConstraintViolationHandler

      public ConstraintViolationHandler(@NonNull StatusCode statusCode, @NonNull String title, boolean logException, boolean problemDetailsEnabled)
  • Method Details