我正在使用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结果我得到了这个文件:
"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"
}
}
]
据我所知String requestString,默认情况下会生成参数 name="body"。我怎样才能删除它?我只希望出现我的参数 name="object"。
慕森卡
相关分类