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

Comments

Projects
None yet
4 participants
@djpotter77

djpotter77 commented Apr 24, 2015

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

This comment has been minimized.

Show comment
Hide comment
@fabiomaffioletti

fabiomaffioletti Apr 27, 2015

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.

Owner

fabiomaffioletti commented Apr 27, 2015

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

This comment has been minimized.

Show comment
Hide comment
@djpotter77

djpotter77 Apr 29, 2015

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.

djpotter77 commented Apr 29, 2015

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

This comment has been minimized.

Show comment
Hide comment
@fabiomaffioletti

fabiomaffioletti Apr 29, 2015

Owner

Ok, I got it. Thank you.

Owner

fabiomaffioletti commented Apr 29, 2015

Ok, I got it. Thank you.

@fabiomaffioletti fabiomaffioletti added this to the 1.1.14 milestone Apr 29, 2015

@cendy172

This comment has been minimized.

Show comment
Hide comment
@cendy172

cendy172 May 15, 2015

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

cendy172 commented May 15, 2015

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

@cendy172

This comment has been minimized.

Show comment
Hide comment
@cendy172

cendy172 May 15, 2015

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

cendy172 commented May 15, 2015

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

@fabiomaffioletti

This comment has been minimized.

Show comment
Hide comment
@fabiomaffioletti

fabiomaffioletti May 15, 2015

Owner

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

Owner

fabiomaffioletti commented May 15, 2015

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

This comment has been minimized.

Show comment
Hide comment
@Manfred73

Manfred73 Aug 17, 2015

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.

Manfred73 commented Aug 17, 2015

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

This comment has been minimized.

Show comment
Hide comment
@fabiomaffioletti

fabiomaffioletti Aug 17, 2015

Owner

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

Owner

fabiomaffioletti commented Aug 17, 2015

@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