我正在使用swagger-jersey2-jaxrs生成swagger.json. 這是我的Java代碼:@Path("/example")@POST@Consumes(MediaType.APPLICATION_JSON)@Produces(MediaType.APPLICATION_JSON)@ApiImplicitParams({ @ApiImplicitParam(name = "object", required = true, dataTypeClass = MyObject.class, paramType = "body")})@ApiOperation(value = "Return one entity", notes = "Returns one entity at random", response = CommonResponse.class)public String getStuff(String requestString) {...}swagger.json結(jié)果我得到了這個文件:"parameters": [ { "in": "body", "name": "body", // SHOULD BE REMOVED "required": false, "schema": { "type": "string" } }, { "in": "body", "name": "object", // I ONLY WANT THIS "required": true, "schema": { "$ref": "#/definitions/MyObject" } } ]據(jù)我所知String requestString,默認(rèn)情況下會生成參數(shù) name="body"。我怎樣才能刪除它?我只希望出現(xiàn)我的參數(shù) name="object"。
在 Swagger 文檔中隱藏控制器參數(shù)
阿波羅的戰(zhàn)車
2021-12-01 19:38:30