Skip to content
Advertisement

Tag: hibernate-validator

How to return a custom response for validation errors using Hibernate Validator and Quarkus

I implemented a REST endpoint in my Quarkus application. For validation purpose I’m using the hibernate-validator. So I added the @Valid annotation to the incoming parameter and added some constraints to that class. Everythings works as expected. When sending a request with invalid data I see a response like this: But I would like to have a more compact response

post method not supported in patch method

I want edit entity with validating by hibernate-validator, but when calling the patch method, an error is thrown: post method not supported. How to make @PatchMapping work correctly? I am a beginner developer, help me please. Controller: Service: Repository: html form: Answer you can not use ‘PATCH’ for the form method attribute. only ‘GET’ and ‘POST’ methods are allowed(source).

javax’s @Valid annotation usage scenario

Is it possible to use @Valid (javax.validation.Valid) in below scenario? Here JsonStringToObjectConvertor is taking in JSON in form of String and mapping it to IncidentModel class. I have defined few validations in IncidentModel in below manner and I want to validate the fields mapped by ObjectMapper in IncidentModel before proceeding further: It does not seem to work in the above

Validation issue with javax constraint

In a spring boot application, I have an entity where I put some annotation validation. Value for theses files I get many error Freq have one character, why i get this message? Empty value is lower then 17 for currency.. I don’t understand why this error occur. Answer The @Max annotation are validation for these types: BigDecimal, BigInteger, byte, short,

Advertisement