Swagger ApiModelProperty not working

I have a problem with @ApiModelProperty in swagger. In my model, I use @ApiModelProperty like this

 private static final long serialVersionUID = -7142106197262010406L; private int brandId; private String brandName; private String fullName; private String webSite; private String logoUrl; private String note; @ApiModelProperty(position = 1, required = true, value="") public int getBrandId() { return brandId; } public void setBrandId(int brandId) { this.brandId = brandId; } @ApiModelProperty(position = 2, required = true) public String getBrandName() { return brandName; } public void setBrandName(String brandName) { this.brandName = brandName; } @ApiModelProperty(position = 3, required = true) public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } @ApiModelProperty(position = 4, required = true) public String getWebSite() { return webSite; } public void setWebSite(String webSite) { this.webSite = webSite; } @ApiModelProperty(position = 5, required = true) public String getLogoUrl() { return logoUrl; } public void setLogoUrl(String logoUrl) { this.logoUrl = logoUrl; } @ApiModelProperty(position = 6, required = true) public String getNote() { return note; } public void setNote(String note) { this.note = note; } 

I do not understand why @ApiModelProperty does not work. Who can help me solve this problem. You are welcome. Thanks everyone!

0
java swagger
source share
2 answers

Have you commented on your class using @ApiModel?

 @ApiModel public class Brand{ private String brandName; //... @ApiModelProperty(position = 1, required = true, value="") public int getBrandId() { return brandId; } public void setBrandId(int brandId) { this.brandId = brandId; } //... } 
+1
source share

Value @ApiModelProperty Must be a non-field level level. Move these annotations to the top level where you have a variable declaration.

-2
source share

All Articles