Springfox: Response Content Type down is NOT showing the proper content type in version above 0.8.8

Created on 22 Jun 2015  路  3Comments  路  Source: springfox/springfox

Hi,

The drop down against Response Content Type is not showing proper content type.The below image is for com.mangofactory:swagger-springmvc:1.0.2
image

However, same thing is getting displayed properly with version: 0.8.8 as shown below:
image

can-use-for-docs question

Most helpful comment

@ahmadimt, @igilham The other way to do this is to add defaults to the docket during the configuration.

    docket
    ...
        .produces(newArrayList("application/json") //Or whatever default value(s)
        .consumes(newArrayList("application/json") //Or whatever default value(s)
    ...

All 3 comments

I found the same thing in my Spring Boot application using Spring Web MVC.

In my case the fix was to ensure the @RequestMapping included a definition for produces

@RequestMapping(method = RequestMethod.GET, produces = "application/json")
@ApiOperation(value = "get a thing", response = Thing.class)
@ResponseBody
private Thing getThing() {
    return new Thing();
}

Will add this a feature to allow specification of default content type. Currently it's defaulted to the _any_ media type when none is specified

@ahmadimt, @igilham The other way to do this is to add defaults to the docket during the configuration.

    docket
    ...
        .produces(newArrayList("application/json") //Or whatever default value(s)
        .consumes(newArrayList("application/json") //Or whatever default value(s)
    ...
Was this page helpful?
0 / 5 - 0 ratings