Swagger-spray增加了额外的参数

时间:2016-03-30 06:56:05

标签: scala swagger spray

我从喷雾招摇转换为招摇喷雾,以便产生swagger2.0,我遇到了以下问题:swagger-spray自动添加了' body& #39;,除了手动指定的@ApiImplicitParams之外,还适用于所有实际的函数参数。

带注释的代码:

@Path("areas/{areaId}/items/{itemId}")
@ApiOperation("Retrieves an item from an area by id", httpMethod = "GET", produces = "application/json", consumes = "application/json")
@ApiImplicitParams(Array(
  new ApiImplicitParam(name = "areaId", paramType = "path", required = true, dataType = "integer", value = "Items area")
  new ApiImplicitParam(name = "itemId", paramType = "path", required = true, dataType = "integer", value = "Item id")
))
def getItem(areaId: Int, itemId: Int) = { ... }

生成的招摇包含以下内容:

...
parameters: [
{
  in: "body",
  name: "body",
  required: false,
  schema: {
    type: "integer",
    format: "int64"
  }
},
{
  in: "body",
  name: "body",
  required: false,
  schema: {
    type: "integer",
    format: "int64"
  }
},
{
  name: "areaId",
  in: "path",
  description: "Items area",
  required: true,
  type: "integer"
},
{
  name: "itemId",
  in: "path",
  description: "Item id",
  required: true,
  type: "integer"
} ]

而不是只有最后一个2.任何想法这些额外的参数来自何处/如何压制它们/我做错了什么?

由于

0 个答案:

没有答案