spring - Why is Swagger's api-docs response wrapped in additional JSON Object? -
i added swagger spring boot application including dependency:
<dependency> <groupid>io.springfox</groupid> <artifactid>springfox-swagger2</artifactid> <version>2.3.1</version> </dependency>
and adding config class:
@configuration @enableswagger2 public class swaggerconfig { @bean public docket api(){ return new docket(documentationtype.swagger_2) .select() .apis(requesthandlerselectors.any()) .paths(predicates.or(pathselectors.regex("..."))) .build() .apiinfo(apiinfo()); } private apiinfo apiinfo() { return new apiinfo(...); } }
i can access /v2/api-docs
, json seems describe api. however, json wrapped in json object (abbreviated): {"value":"{\"swagger\":\"2.0\",\"info\":...}
the {"value": "..."}
object isn't needed , causes errors in swagger-ui. petstore example doesn't has level. this bug? or config issue?
ps: created github issue that
the guys on @ https://github.com/springfox/springfox/issues/1156 pointed me in right direction. problem follows:
i'm using gson instead of jackson de-/serialise json. when object of type springfox.documentation.spring.web.json.json
gets serialised, included annotation considered jackson ignored gson.
Comments
Post a Comment