swagger-codegen
swagger-codegen copied to clipboard
swagger-codegen-maven-plugin server code generation
I am trying to generate the server code using swagger-codegen-maven-plugin but it is generating the code with swagger 1.5 annotations like @ApiModel and @ApiModelProperty and not using @Operation & @Schema.
I am using the following config and dependencies in pom:
<plugin>
<!-- code gen start -->
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.20</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/openapi/${project.name}.yml</inputSpec>
<language>spring</language>
<!--<packageName>${client.base.package.name}</packageName>
<modelPackage>${client.base.package.name}.model</modelPackage>
<apiPackage>${client.base.package.name}.api</apiPackage>
<invokerPackage>${client.base.package.name}.invoker</invokerPackage>-->
<output>${project.build.directory}/generated-sources/openapi</output>
<apiPackage>${project.groupId}.generated.api</apiPackage>
<modelPackage>${project.groupId}.generated.model</modelPackage>
<generateSupportingFiles>false</generateSupportingFiles>
<configOptions>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<artifactVersion>${project.version}</artifactVersion>
<!--<library>resttemplate</library>-->
<java8>true</java8>
<dateLibrary>java8</dateLibrary>
<interfaceOnly>true</interfaceOnly>
<!-- <licenseName>Apache 2.0</licenseName>
<licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>-->
</configOptions>
</configuration>
</execution>
</executions>
<!-- <dependencies>
<dependency>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-generators</artifactId>
<version>1.0.20</version>
</dependency>
</dependencies>-->
</plugin>
<!-- code gen end -->
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.1.9</version>
</dependency>
It appears that the swagger-codegen-maven-plugin 3.0.26 generates the Swagger 3 annotations.