You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Library takes parameter type from it's Java definition.
There's a Spring Boot integration issue with Hibernate validators related to types validation. Before running validators, Spring is changing request default parameter type which is String to expected by Controller. Like it was done in given code.
For instance, we got that declaration.
@Min(10) @RequestParam(name = "age") int age
Then we're doing request where age gets some String value. That causes exception below.
org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Method parameter 'age': Failed to convert value of type 'java.lang.String' to required type 'int'; For input string: "asdas"
I can try to create @Integer validator, but it won't be reached, since I will get exception above first.
It means that every Controller parameter should be a String and then every validator should validate a type.
The disadvantage is that Swagger documentation won't be properly crafted. Every parameter will be marked as a String one, when in reality it's not.
I imagine it should be possible to provide an expected type in annotation as well. Like ...
@Parameter(name="age", type"integer")
The text was updated successfully, but these errors were encountered:
I'm trying to create a public API using:
v3.4.0
v2.7.0
v8.0.1
Request definition.
For that definition, library will output specification below.
Library takes parameter type from it's Java definition.
There's a Spring Boot integration issue with Hibernate validators related to types validation. Before running validators, Spring is changing request default parameter type which is String to expected by Controller. Like it was done in given code.
For instance, we got that declaration.
Then we're doing request where
age
gets some String value. That causes exception below.I can try to create
@Integer
validator, but it won't be reached, since I will get exception above first.It means that every Controller parameter should be a
String
and then every validator should validate a type.The disadvantage is that Swagger documentation won't be properly crafted. Every parameter will be marked as a
String
one, when in reality it's not.I imagine it should be possible to provide an expected type in annotation as well. Like ...
The text was updated successfully, but these errors were encountered: