用java代码生成swagger文档_使用Javadocs生成Swagger文档

我想为现有的一组RESTful API构建Swagger文档.我有以下要求:

>离线生成Swagger Doc(我使用了http://kongchen.github.io/swagger-maven-plugin/).这个插件帮助我在编译期间生成Swagger文档.

>阅读现有的Javadoc,以便可以在Swagger文档中使用它们.

到目前为止使用上面的插件我能够实现第1点.所以对于现有的REST方法:

/**

*

* Gets the {@link DisplayPreferenceModel} with the name as provided in the parameter. The preference with the given name defined at the tenant or master level is returned.

* This API gives us the preference if it is eligible for unauthorized access If it is not eligible it throws an Exception saying Authorization required.

*

* @param preferenceName

* - The name of the preference.

* @return {@link DisplayPreferenceModel}

*/

@RequestMapping(method = RequestMethod.GET, value = "/preferences/{preferenceName}")

@ApiOperation(value = "This API gives us the preference if it is eligible for unauthorized access If it is not eligible it throws an Exception saying Authorization required",

notes = "No Notes please", response = DisplayPreferenceModel.class)

@ApiResponses(value = {

@ApiResponse(code = 400, message = "Invalid preferenceName supplied"),

@ApiResponse(code = 404, message = "Display Preference Not Found")

}

)

public DisplayPreferenceModel getDisplayPreference( @PathVariable("preferenceName") final String preferenceName ) {

}

我能够生成Swagger文档. @ApiOperation&的用法@ApiResponses使我的文档看起来很棒.

但是,我的问题是我可以使用Javadoc而不是让每个开发人员创建@ApiOperation& @ApiResponses以便为我的团队节省时间?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值