使用swagger生成API的json文件
使用swagger可以方便的生成REST API,最近有机会了解一下,就记录下小小的踩坑经历吧.
demo使用maven搭建,REST采用jersey,swagger的版本选用了新版(即io.swagger),接着就是要用到的swagger-maven-plugin了.
- 在pom.xml中添加plugin
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>false</springmvc> <!-- false为JAX-RS -->
<locations>com.rooyeetone.rtprest.rest</locations>
<schemes>http,https</schemes>
<host>