There is no difference between annotating nested or not nested Swagger models.
You have to add io.swagger.annotations.ApiModelProperty annotation to each attribute of the model.
public GenericModel {
@ApiModelProperty(value = "ID")
private int id;
@ApiModelProperty(value = "Code")
private String code;
@ApiModelProperty(value = "Parent Id")
private int parentId;
@ApiModelProperty(value = "Children")
private List<GenericModel> children = new ArrayList<>();
...
}
If the list object is a collection of other models you must annotate the corresponding model (with @ApiModelProperty annotations) as well.