如何在 Swagger 中添加有关 API 的更多信息?

sta*_*lar 2 java javadoc api-doc swagger

我包含swagger-springmvc在我的项目中并设法让 Swagger UI 工作,但现在关于 UI 中 API 的信息很少。我所看到的只是通过反射提取的信息。

这是控制器方法的样子:

/**
 * Read all users matching given filter
 * @param String filter The text by which to filter the usernames
 * @return User[] Array of users matching given filter
 * @throws Exception
 */
@RequestMapping(value = "/users/{filter}", method = RequestMethod.GET)
public
@ResponseBody
Collection<User> getUsers(@PathVariable("filter") String filter) throws Exception {
    return domain.getUsersFilteredBy(filter);
}
Run Code Online (Sandbox Code Playgroud)

在每个方法的右侧,Swagger 记录了方法的名称,在这种情况下:

get Users
Run Code Online (Sandbox Code Playgroud)

但我期待看到这个:

Read all users matching given filter
Run Code Online (Sandbox Code Playgroud)

在 helloreverb.com 上的示例中,我看到了每种方法的描述。我怎样才能像这样大摇大摆地将我的控制器方法的描述添加到 UI 中?

Swagger 文档示例

小智 5

@ApiOperation(value = "Read all users matching given filter",  notes = "Will get all the users for the given filter")
Run Code Online (Sandbox Code Playgroud)