HV000030: No validator could be found for constraint 'javax.validation.constraints.Min' validating type 'java.util.Optional<java.lang.Integer> #11315
Unanswered
vinaygadiraju
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am getting the below error while using generated code server side when using minimum & maximum on integer type. If anybody some across this issue.. Please suggest..!
Thanks In Advance
swagger-codegen-maven-plugin version > 3.0.29
Spring boot version > 2.2.7.RELEASE
`"pageNumber": {
"description": "Page number for records.",
"type": "integer",
"example": 50,
"minimum": 1,
"default": 1
}
This version generates as below.
@Min(1)@Parameter(in = ParameterIn.QUERY, description = "Page number for records." ,schema=@Schema(allowableValues={ }, minimum="1" , defaultValue="1")) @Valid @RequestParam(value = "pageNumber", required = false, defaultValue="1") Optional<Integer> pageNumber
I think the Hibernate validator expects something like this
@Parameter(in = ParameterIn.QUERY, description = "Page number for records." ,schema=@Schema(allowableValues={ }, minimum="1", defaultValue="1")) @Valid @RequestParam(value = "pageNumber", required = false, defaultValue="1") Optional<**@Min(1)** Integer> pageNumber
Simply Optional<@min(1) Integer> instead of @min(1) Optional
`
HV000030: No validator could be found for constraint 'javax.validation.constraints.Min' validating type 'java.util.Optional<java.lang.Integer>
Beta Was this translation helpful? Give feedback.
All reactions