如标题中所述,我对swagger maven插件的配置似乎正在跳过使用@BeanParam注释的参数。
我已经以与github上示例相同的方式配置了我的代码(在下面的链接中显示),所以我不知道这是怎么回事。
Call in main class MyBean example
这是我当前的配置
//MyInterface.java
@Api(value = "myInterface")
public interface MyInterface {
@Path("/.../{bar}/.../{baz}")
Response foo(@BeanParam MyBean myBean);
}
//MyBean.java
public class MyBean {
@PathParam("bar")
private Long bar;
@PathParam("baz")
private Long baz;
//getters and setters
}
<!-- pom.xml -->
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.8</version>
<executions>
<execution>
<id>ID</id>
<phase>compile</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<apiSources>
<apiSource>
<springmvc>false</springmvc>
<locations>
<location>package.of.MyInterface</location>
<location>package.of.MyBean</location>
</locations>
<schemes>
<scheme>https</scheme>
</schemes>
<host>${swagger.ui.host}</host>
<basePath>/api</basePath>
<info>
<title>Title</title>
<version>1.0.0</version>
<description>Desc</description>
</info>
<outputFormats>yaml</outputFormats>
<swaggerFileName>${project.name}-external</swaggerFileName>
<swaggerDirectory>${project.build.directory}/swagger</swaggerDirectory>
</apiSource>
</apiSources>
</configuration>
</execution>
</executions>
</plugin>
---
swagger: "2.0"
#...
paths:
/.../{bar}/.../{baz}:
put:
operationId: "foo"
parameters: []
是什么导致输出中的参数数组保持为空?我所有注释的没有bean的方法都可以正常工作。