Open diega opened 8 years ago
Having a query parameter of type array and defaultValue, doesn't set the defaultValue field for the generated @RequestParam and @ApiParam annotations
@RequestParam
@ApiParam
master
swagger: '2.0' info: version: "1.0.0" title: Title was not specified host: 'localhost:9090' basePath: /base schemes: - http paths: /base/foo: get: responses: '200': description: Success operationId: getFoo parameters: - in: query name: params required: false type: array items: type: string collectionFormat: csv default: - 0759 - 0722 - 6543 /base/bar: get: responses: '200': description: Success operationId: getBar parameters: - in: query name: params required: false type: string default: "0759, 0722, 6543"
$ java -Dapis -jar swagger-codegen-cli.jar generate -i test.yml -l spring --additional-properties interfaceOnly=true -o swagger-output/
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-18T13:13:54.400-03:00") @Api(value = "base", description = "the base API") public interface BaseApi { @ApiOperation(value = "", notes = "", response = Void.class, tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = Void.class) }) @RequestMapping(value = "/base/bar", method = RequestMethod.GET) ResponseEntity<Void> getBar(@ApiParam(value = "", defaultValue = "0759, 0722, 6543") @RequestParam(value = "params", required = false, defaultValue="0759, 0722, 6543") String params); @ApiOperation(value = "", notes = "", response = Void.class, tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = Void.class) }) @RequestMapping(value = "/base/foo", method = RequestMethod.GET) ResponseEntity<Void> getFoo(@ApiParam(value = "") @RequestParam(value = "params", required = false) List<String> params); }
I don't think default value of array/map is supported at the moment. We may need to update the swagger parser in order to support that.
cc @cbornet @ePaul
Description
Having a query parameter of type array and defaultValue, doesn't set the defaultValue field for the generated
@RequestParam
and@ApiParam
annotationsSwagger-codegen version
master
Swagger declaration file content or url
Command line used for generation
$ java -Dapis -jar swagger-codegen-cli.jar generate -i test.yml -l spring --additional-properties interfaceOnly=true -o swagger-output/
Steps to reproduce
Generated stub