8000 How to get object in response body in autogenerated swagger.json file · Issue #2031 · springfox/springfox · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
How to get object in response body in autogenerated swagger.json file #2031
Closed
@rajat-garg

Description

@rajat-garg

The method @requestBody has a String parameter contents which I am converting into object but while generating the swagger.json it is converting it into String as type. So, what is the proper annotation for that?

@RequestMapping(value = "/{keyId}/{id}/content", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "")
    public Model save(@PathVariable("keyId") String keyId,
                              @PathVariable("id") String id,
                              @RequestBody String contents) {
            ObjectMapper om = new ObjectMapper();
            contents = JsonSanitizer.sanitize(contents);
            SaveFruitModel payload = om.readValue(contents, SaveFruitModel.class);
}
"post" : {
        "tags" : [ "Model" ],
        "summary" : "",
        "description" : "",
        "operationId" : "save",
        "parameters" : [ {
          "name" : "keyId",
          "in" : "path",
          "required" : true,
          "type" : "string"
        }, {
          "name" : "id",
          "in" : "path",
          "required" : true,
          "type" : "string"
        }, {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "type" : "string"
          }
        } ],
      

Here I am getting "type":"string" under schema but I want here the type object or the class name so what is the proper annotations for this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0