I have one class in which there is one property which is List
public class MyClass {
....
@ApiModelProperty(position = 2)
This seems to not be supported by the Swagger API. In the mean time you can use this Springfox Plugin to generate a singleton list example (one value list) https://github.com/aaitmouloud/springfox-collection-example-plugin
Just add this to you pom.xml
com.github.aaitmouloud
springfox-collection-example-plugin
2.9.2
And import the right classes to your Spring context
@ComponentScan({"springfox.collection.example.plugins"})
You should then declares a single value example on your property and it will be transformed to a singleton list example by the plugin (works for all java.util.Collection
classes)
@ApiModelProperty(value ="my property description", example = "2019-12-20T12:00:00")
@NotNull
private List dates;
Disclaimer: I am the author of this plugin.