【发布时间】:2016-12-07 14:41:14
【问题描述】:
是否可以使用注释(在字段级别)为字段提供描述?
我知道我可以为此使用description 方法
.andDo(document("index", responseFields(
fieldWithPath("contact").description("The user's contact details"),
但我更愿意将该描述与字段定义放在我的响应对象中。
class IndexResponse {
//The user's contact details
String contract;
}
我知道我可以生成约束描述 (http://docs.spring.io/spring-restdocs/docs/current/reference/html5/#_using_constraint_descriptions_in_generated_snippets),但它生成的描述仅用于验证注释。
我正在寻找来自 Swagger 的 https://github.com/swagger-api/swagger-core/wiki/Annotations#apimodelproperty 之类的东西。
【问题讨论】:
标签: spring-restdocs spring-auto-restdocs