【发布时间】:2020-06-22 17:32:04
【问题描述】:
我正在使用 Kotlin 开发 Spring Boot。现在我想创建 API 文档,但是它们的注释很笨拙和罗嗦。
当前:
@ApiResponses(
ApiResponse(responseCode = "200", description = "Result depending on the role of the user", content = [Content(schema = Schema(oneOf = [AdminResponse::class, UserResponse::class]))])
)
fun get(authentication: Authentication): Any {
[...]
}
我想要的样子:
@Api(
Response(200, "Result depending on the role of the user", [AdminResponse::class, UserResponse::class])
)
fun get(authentication: Authentication): Any {
[...]
}
我可以用一些东西来存档吗?一些想法是预处理和类型别名。
【问题讨论】:
标签: spring spring-boot kotlin annotations springdoc