如何使用 swagger OpenAPI 注释设置对字段的描述
How to set description to a field using swagger OpenAPI annotations
为了改进我们的 api 文档,我想在响应正文的字段中添加描述
例如,请在此处查看默认的宠物店规范:https://editor.swagger.io/
在POST/pet
在宠物响应中,状态描述为“商店中的宠物状态”
如何在我的代码库中从注释的角度做到这一点?
(招摇 v3)
kotlin 中的解决方案:
data class Pet(
@field:Schema(description = "Pet status in the store")
val status: String
)
import io.swagger.v3.oas.annotations.media.Schema;
public class Pet {
@Schema(description = "Pet status in the store")
private String status;
}
感谢@viktor-baert
为了改进我们的 api 文档,我想在响应正文的字段中添加描述
例如,请在此处查看默认的宠物店规范:https://editor.swagger.io/
在POST/pet 在宠物响应中,状态描述为“商店中的宠物状态”
如何在我的代码库中从注释的角度做到这一点?
(招摇 v3)
kotlin 中的解决方案:
data class Pet(
@field:Schema(description = "Pet status in the store")
val status: String
)
import io.swagger.v3.oas.annotations.media.Schema;
public class Pet {
@Schema(description = "Pet status in the store")
private String status;
}
感谢@viktor-baert