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

When using the "javax.validation.constraints" annotation on the request parameter, the parameter is only recognized as "application / json" (POST/DELETE/PUT Http method) #3465

Open
zhengxiang5965 opened this issue Jul 30, 2020 · 2 comments
Labels
Milestone

Comments

@zhengxiang5965
Copy link

#3338 Only fixed the GET method
issue1
issue2
issue3
issure4
So the developer cannot get the parameter type of the interface correctly(DELETE/PUT/POST).

@zhengxiang5965
Copy link
Author

And all the annotations under the "org.hibernate.validator.constraints" package

@dilipkrish dilipkrish added the bug label Aug 3, 2020
@dilipkrish dilipkrish added this to the 3.0.1 milestone Aug 3, 2020
@aseria
Copy link

aseria commented Mar 1, 2021

Try annotate @RequestParam at parameter.
Like
public void test2(@NotNull @RequestParam Integer id)

I think it maybe works.
See the src/main/java/springfox/documentation/spring/web/readers/parameter/ParameterTypeReader.java

else if (resolvedMethodParameter.hasParameterAnnotation(RequestParam.class)) {
      return determineScalarParameterType(
          parameterContext.getOperationContext().consumes(),
          parameterContext.getOperationContext().httpMethod());
    } 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants