swagger-api / swagger-api/swagger-codegen
swagger-codegen-maven-plugin server code generation
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
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>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the swagger-codegen-maven-plugin configuration using the spring language and the generated server output. Check how the generator handles the supplied OpenAPI specification and the swagger-annotations 2.1.9 dependency. Done means generated server code uses @Operation and @Schema rather than the reported older annotations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100