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

ApiQueryParam should use @RequestParam value attribute for its name by default #106

Closed
djpotter77 opened this issue Apr 24, 2015 · 8 comments
Assignees
Milestone

Comments

@djpotter77
Copy link

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) {

@fabiomaffioletti fabiomaffioletti self-assigned this Apr 27, 2015
@fabiomaffioletti
Copy link
Owner

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.

@djpotter77
Copy link
Author

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.

@fabiomaffioletti
Copy link
Owner

Ok, I got it. Thank you.

@cendy172
Copy link

Hello, it seems the issue is fixed, but I cannot find the version 1.1.14 in maven repository.

@cendy172
Copy link

the dependency is org.jsondoc:spring-boot-starter-jsondoc:1.1.14

@fabiomaffioletti
Copy link
Owner

Version 1.1.14 is still under development, it's not released yet.

fabiomaffioletti pushed a commit that referenced this issue May 20, 2015
@Manfred73
Copy link

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.

@fabiomaffioletti
Copy link
Owner

@PathParam is not part of Spring MVC. Did you mean @PathVariable?

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

No branches or pull requests

4 participants