我正在尝试使用 Swagger 来记录我的 REST API。关注此 example ,我这样注释 REST 端点:
case class CreateItemRequest(title: String, body: String)
@ApiOperation(value = "Create a new item", httpMethod = "POST", response = classOf[Item])
@ApiImplicitParams(Array(new ApiImplicitParam(dataType = "CreateItemRequest", paramType = "body", name = "body", required = true, allowMultiple = false, value = "The item object to create")))
def create(
@ApiParam(value = "Hash of the user", required = true)
@QueryParam("userhash") userhash: String
)
我期待得到像 这样的“模型”但我只得到字符串“CreateItemRequest”作为数据类型。不是案例类 CreateItemRequest 的属性。
你好,
丹尼尔
最佳答案
您应该在 dataType 属性中使用完整的命名空间。例如:@ApiImplicitParam(dataType = "org.test.CreateItemRequest")
关于scala - 带有 Play 框架的 ImplicitParam 中的 Swagger 数据类型模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28833529/