我正在使用 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 {
[...]
}
我可以用一些东西来存档吗?一些想法是预处理和类型别名。