swagger @ApiModelProperty example value for List property

前端 未结 9 2386
温柔的废话
温柔的废话 2020-12-14 00:10

I have one class in which there is one property which is List

public class MyClass {
    ....
    @ApiModelProperty(position = 2)
         


        
9条回答
  •  清歌不尽
    2020-12-14 00:48

    Here is a working example for list of objects. Swagger version 2.9.2. All that is needed is for the dataType to define as "List" and it will render in the swagger documentation. Find attached the ProductAll list rendered in the attached picture.

    @ApiModel
    public class ProductGetAllDTO {
        @ApiModelProperty(example="20")
        private String count;
        @ApiModelProperty(dataType="List", value = "rows")
        private List rows;
    }
    

提交回复
热议问题