Skip to content

[Spring] compilation issue - query params enumerations #3792

@rajeshkamal5050

Description

@rajeshkamal5050

When you an enumeration of supported/valid strings specified for the query parameter in the spec

"parameters":[
   {
      "name":"acmeStatus",
      "in":"query",
      "description":"Status of Acme's you want to retrieve.",
      "required":true,
      "type":"string",
      "enum":[
         "SUCCESS",
         "FAILED",
         "INPROGRESS"
      ]
   }
]

The generated spring code - Controller Interface code does not compile. The @ApiParam's allowableValues(String) property gets generated and it has some issues

allowableValues = "{values=[SUCCESS, FAILED, INPROGRESS], enumVars=[{name=SUCCESS, value="SUCCESS"}, {name=FAILED, value="FAILED"}, {name=INPROGRESS, value="INPROGRESS"}]}"

Complete Controller Method

    @ApiOperation(value = "Query Acme's by status", notes = "Get the list of Acme's for the provided Acme status", response = Acme.class, responseContainer = "List", tags={ "AcmeService", })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "OK", response = Acme.class) })
    @RequestMapping(value = "/acmes",
        produces = { "application/json" }, 
        method = RequestMethod.GET)
    ResponseEntity<List<Acme>> getAcmesByStatus(@ApiParam(value = "Status of Acme's you want to retrieve.", required = true, allowableValues = "{values=[SUCCESS, FAILED, INPROGRESS], enumVars=[{name=SUCCESS, value="SUCCESS"}, {name=FAILED, value="FAILED"}, {name=INPROGRESS, value="INPROGRESS"}]}") @RequestParam(value = "acmeStatus", required = true) String acmeStatus



);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions