我的目标是生成一个 swagger 定义 like this来 self 的 Jersey 资源。
为了得到这个,我的 pom.xml 看起来像:
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<apiSources>
<apiSource>
<locations>com.rest.resources</locations>
<apiVersion>1.0</apiVersion>
<swaggerDirectory>${basedir}/src/main/webapp/docs</swaggerDirectory>
</apiSource>
</apiSources>
</configuration>
</plugin>
我也有 swagger/jersey 依赖:
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.10</artifactId>
<version>1.3.10</version>
<scope>compile</scope>
</dependency>
json 生成得很好,但是我为每个资源获取一个 json 文件,而不是只有一个
我缺少什么
最佳答案
您没有遗漏任何内容,它正在按预期工作。
即使在您提供的链接中,每个资源都有一个文件。 查看这些链接:
http://petstore.swagger.wordnik.com/api/api-docs/pet
关于jersey-2.0 - 使用 swagger 从 Jersey 生成 JSON 定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27111894/