gpt4 book ai didi

scala - 带有 Play 框架的 ImplicitParam 中的 Swagger 数据类型模型

转载 作者:行者123 更新时间:2023-12-04 17:34:13 25 4
gpt4 key购买 nike

我正在尝试使用 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
)

我期待得到像 this 这样的“模型”但我只得到字符串“CreateItemRequest”作为数据类型。不是案例类 CreateItemRequest 的属性。

你好,
丹尼尔

最佳答案

您应该在 dataType 属性中使用完整的命名空间。例如:@ApiImplicitParam(dataType = "org.test.CreateItemRequest")

关于scala - 带有 Play 框架的 ImplicitParam 中的 Swagger 数据类型模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28833529/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com