swagger-api / swagger-api/swagger-codegen
swagger-codegen-maven-plugin overwrites files even when listed on .swagger-codegen-ignore
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Issue is raised with Java when using: io.swagger.codegen.v3:swagger-codegen-maven-plugin:3.0.21 when building with gradle.
The content of the .swagger-codegen-ignore is:
**/DocumentApi.java
I'm adding the swagger ignore file location in gradle generateServer task
task generateServer {
doLast {
def openAPI = new OpenAPIV3Parser().read(swaggerFile, null, null)
def clientOpts = new ClientOptInput().openAPI(openAPI)
def codegenConfig = CodegenConfigLoader.forName('spring')
codegenConfig.setIgnoreFilePathOverride("$projectDir".toString()+"/src/main/resources/static/.swagger-codegen-ignore")
however, the file DocumentApi.java is regenerated and the old configuration is not preserved.
Can you please tell me how to avoid the regeneration of a specific API or how I can exclude in the configuration that an api definition to be created for a specific endpoint?
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 report using swagger-codegen-maven-plugin 3.0.21, the shown Gradle generateServer task, and a .swagger-codegen-ignore entry for **/DocumentApi.java. Trace how CodegenConfigLoader and setIgnoreFilePathOverride handle that file, then verify that generation preserves the existing DocumentApi.java content while other generated files still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100