OpenAPITools / OpenAPITools/openapi-generator
[JAVA] beta3 adds springfox import in spring generator
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
I have upgraded from beta2 to beta3 and the java spring code generated from the api yaml file contains the import:
springfox.documentation.annotations.ApiIgnore
but the compiler fails on this import.
openapi-generator version
beta3, was working in beta2
OpenAPI declaration file content or url
paths:
/endpoint:
post:
summary: Whatever
tags:
- endpoint
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Whatever'
responses:
"201":
content:
application/json:
schema:
$ref: '#/components/schemas/Something'
"400":
$ref: '#/components/responses/BadRequest'
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
"500":
$ref: '#/components/responses/InternalServerError'
Command line used for generation
mvn clean generate-sources
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${version.plugin.openapi.generator}</version>
<configuration>
<generateModels>true</generateModels>
<generateApi>true</generateApi>
<generateSupportingFiles>true</generateSupportingFiles>
<generateAliasAsModel>true</generateAliasAsModel>
<generatorName>spring</generatorName>
<generateApiDocumentation>true</generateApiDocumentation>
<generateModelDocumentation>true</generateModelDocumentation>
<generateApiTests>true</generateApiTests>
<configOptions>
<interfaceOnly>true</interfaceOnly>
<serializableModel>true</serializableModel>
<dateLibrary>java8</dateLibrary>
<library>spring-boot</library>
<ensureUniqueParams>false</ensureUniqueParams>
<useBeanValidation>true</useBeanValidation>
</configOptions>
<!-- enable configHelp to see all the available configOptions -->
</configuration>
<executions>
<execution>
<id>generate-model</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<modelPackage>whatever.api.model</modelPackage>
<apiPackage>whatever.api.model</apiPackage>
<invokerPackage>whatever.api.model</invokerPackage>
<inputSpec>${project.build.resources[0].directory}/api/whatever.yaml</inputSpec>
</configuration>
</execution>
</executions>
</plugin>
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
Reproduce the beta3 issue with the spring generator and the provided Maven configuration using mvn clean generate-sources. Inspect the generated Java output for the springfox.documentation.annotations.ApiIgnore import and compare it with beta2 behavior. Done means the spring-generated code no longer contains an unresolved import and compiles successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, spring, spring-boot
- Domain
- api, backend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100