Swagger Maven Plugin doesn't generate operations and models

Viewed 584

I have a Spring Boot app and use Swagger Maven Plugin from https://github.com/kongchen/swagger-maven-plugin

The configuration in pom.xml is below:

        <plugin>
            <groupId>com.github.kongchen</groupId>
            <artifactId>swagger-maven-plugin</artifactId>
            <version>3.1.8</version>
            <configuration>
                <apiSources>
                    <apiSource>
                        <attachSwaggerArtifact>true</attachSwaggerArtifact>
                        <outputFormats>json</outputFormats>
                        <locations>package.with.apis</locations>
                        <schemes>
                            <scheme>http</scheme>
                            <scheme>https</scheme>
                        </schemes>
                        <host>localhost:8083</host>
                        <basePath>/api</basePath>
                        <info>
                            <title>Your API name</title>
                            <version>v2</version>
                            <description>Description of your API</description>
                        </info>
                        <swaggerDirectory>generated/swagger-ui</swaggerDirectory>
                    </apiSource>
                </apiSources>
            </configuration>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

<locations>package.with.apis</locations> is the package containing all the interfaces tagged with @Api

<swaggerDirectory>generated/swagger-ui</swaggerDirectory> is the directory where the generated swagger.json lands

But the generated swagger.json doesn't contain the information in @ApiOperation, @ApiResponses, DTO models etc.

It seems to contain only the values of @Api(tags = {"API ..."})

Below is the excerpt from it:

{
  "swagger" : "2.0",
  "info" : {
    "description" : "Description of your API",
    "version" : "v2",
    "title" : "Your API name"
  },
  "host" : "localhost:8083",
  "basePath" : "/api",
  "tags" : [ {
    "name" : "API 1",
    "description" : ""
  }, {
    "name" : "API 2",
    "description" : ""
  }, {
...

What am I missing? How should I configure it properly so that it generates a JSON that describes the API completely comparable with what we usually see at http://localhost:8080/swagger-ui.html endpoint?

0 Answers
Related