swagger @ApiModelProperty example value for List property

前端 未结 9 2370
温柔的废话
温柔的废话 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:58

    An ugly workaround until we have this feature properly supported, which produces examples for lists with only one element, but at least allows to show something more useful than just "string" is by using allowableValues:

    @ApiModelProperty(position = 2, allowableValues = "PRD1")
    // This generates -> "productIdentifiers": ["PRD1"]
    

提交回复
热议问题