Swagger spring fox不处理List和数组的响应模型

时间:2016-11-30 10:29:49

标签: spring spring-mvc swagger swagger-ui

我正试图用一个带有弹簧mvc的api来公开它,然后用昂首阔步来记录它。

 @RequestMapping(value="/entry/", method=RequestMethod.GET)
@ApiOperation(value = "Retrieves all diary entries persisted in the database",produces = "application/json" ,responseContainer = "List", response = Entry.class)
public List<Entry> getDiaryEntries() {
    List<Entry> diaryEntries =new ArrayList<>();
    diaryEntries.add(new Entry());

    return  diaryEntries;
}

当我看到招摇的ui时

[enter image description here

数组内容看起来 undefined 虽然我指定了responseContainer =“List”,response = Entry.class。

我希望像

这样的东西
[{ "title" : "" , "text":"" } ]

0 个答案:

没有答案