jax-rsswagger-maven-plugin

Swagger Maven Plugin not generating parameters from @BeanParam annotatated parameters


As stated in the title, my configuration of the swagger maven plugin seems to be skipping over parameters annotated with @BeanParam.

I have configured my code in the same way as it is in the example on github (shown in links below), so I do not know what would be wrong.

Call in main class MyBean example

Here is my current configuration

My Input Files

//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>

My Output Swagger File

---
swagger: "2.0"
#...
paths:
  /.../{bar}/.../{baz}:
    put:
      operationId: "foo"
      parameters: []

What is causing the parameters array in the output to remain empty? All my methods annotated without beans work fine.


Solution

  • I ended up using this plugin instead, the documentation is a bit sparse but combing through the examples helps a lot. As an added bonus it generates openapi3 instead of swagger 2.