[英]Swagger Example Parameter Value
I want to modify the Example Value under the Data Type on my Swagger-ui interface. 我想修改Swagger-ui接口上数据类型下的Example Value。 currently it contains the following default value (generated by Swagger): 目前它包含以下默认值(由Swagger生成):
"user":{
"birth":null,
"nationality":null,
"lastname":null,
"firstname":null,
"identity":null
}
I want to specify real values instead of the "null" values. 我想指定实际值而不是“null”值。 PS: I use spring boot with annotations: @ApiOperation,... PS:我使用带注释的spring boot:@ApiOperation,...
You must then insert @ApiModelProperty anotation for all your attributes inside your bean. 然后,必须为bean中的所有属性插入@ApiModelProperty anotation。 Then put an example attribute inside. 然后在里面放一个示例属性。 Let's say your user is mapped to the User.java class, so you would have: 假设您的用户已映射到User.java类,因此您将拥有:
public class User {
@ApiModelProperty(value = "The birthdate", example = "1985-12-07", format= "yyyy-MM-dd")
private String birth;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.