-
Notifications
You must be signed in to change notification settings - Fork 127
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
ApiQueryParam should use @RequestParam value attribute for its name by default #106
Comments
Can't reproduce. See SpringJSONDocScannerTest in project jsondoc-springmvc, which has a test to verify that the param name is taken from the RequestParam Spring's annotation. |
The issues is that the name attribute of the ApiQueryParam annotation is required and doesn't have a default value, so you have to specify it in your code. |
Ok, I got it. Thank you. |
Hello, it seems the issue is fixed, but I cannot find the version 1.1.14 in maven repository. |
the dependency is org.jsondoc:spring-boot-starter-jsondoc:1.1.14 |
Version 1.1.14 is still under development, it's not released yet. |
I'm using version 1.1.16 and found that the following works: @ApiQueryParam in combination with Spring's @RequestParam works ok. The name and required attributes are taken from @RequestParam. However, the following doesn't work: @ApiPathParam in combination with @PathParam (for required fields): I still have to specify the 'path parameter name' within the @ApiPathParam annotation, so it's not taking the default name from Spring's @PathParam. |
@PathParam is not part of Spring MVC. Did you mean @PathVariable? |
The ApiQueryParam annotation should use the Spring @RequestParam value attribute for its name attribute by default if it's present. It already uses other information (e.g. required) from the RequestParam annotation, but having to specify the same param name in both annotations seems unnecessary and error-prone.
For example, you currently have to do this:
public String sayHello(@ApiQueryParam(name = "personName", description = "The person to greet") @RequestParam(value = "personName", required = true) String personName) {
The text was updated successfully, but these errors were encountered: