Swagger 正在为 get 方法添加额外的 body 参数
Swagger is adding additional body parameter for get method
我正在使用 swagger akka-http 包装器,目前对于我的 get 请求,swagger 在字符串类型的 swagger 规范中添加了额外的 body 参数
@Path("/{id}/status")
@ApiOperation(httpMethod = "GET", response = classOf[JobStatus], value = "Returns Job status")
@ApiImplicitParams(Array(
new ApiImplicitParam(name = "id", required = true, dataType = "integer", paramType = "path", value = "Job id for which status be fetched")))
@ApiResponses(Array(
new ApiResponse(code = 200, message = "OK", response = classOf[JobStatus]),
new ApiResponse(code = 404, message = "Job not found")))
def getStatus(id: String): Route =
get {
....
我想知道这是因为 getStatus 方法采用参数 "id",请问大家有什么建议吗
生成的文档基于函数参数和隐式参数(即 2 个参数集的并集)。
如果您需要覆盖其声明的 String 类型,我建议您删除 ApiImplicitParam 注释并在函数参数列表中的 id 字段中添加 ApiModelProperty 注释。
ApiModelProperty 注释的使用示例:
https://github.com/pjfanning/swagger-akka-http-sample/blob/master/src/main/scala/com/example/akka/addoption/AddOptionActor.scala
我正在使用 swagger akka-http 包装器,目前对于我的 get 请求,swagger 在字符串类型的 swagger 规范中添加了额外的 body 参数
@Path("/{id}/status")
@ApiOperation(httpMethod = "GET", response = classOf[JobStatus], value = "Returns Job status")
@ApiImplicitParams(Array(
new ApiImplicitParam(name = "id", required = true, dataType = "integer", paramType = "path", value = "Job id for which status be fetched")))
@ApiResponses(Array(
new ApiResponse(code = 200, message = "OK", response = classOf[JobStatus]),
new ApiResponse(code = 404, message = "Job not found")))
def getStatus(id: String): Route =
get {
....
我想知道这是因为 getStatus 方法采用参数 "id",请问大家有什么建议吗
生成的文档基于函数参数和隐式参数(即 2 个参数集的并集)。 如果您需要覆盖其声明的 String 类型,我建议您删除 ApiImplicitParam 注释并在函数参数列表中的 id 字段中添加 ApiModelProperty 注释。
ApiModelProperty 注释的使用示例: https://github.com/pjfanning/swagger-akka-http-sample/blob/master/src/main/scala/com/example/akka/addoption/AddOptionActor.scala