OpenAPITools / OpenAPITools/openapi-generator

[REQ] Option to automatically delete all files/folders in outputDir for openapi gradle plugin

Open
#5,869 3 comments 18 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

For openapi-generator-gradle-plugin, could you add option to automatically delete all files and folders in outputDir before generating the code files?

The option can be called "cleanOputputDir" (boolean) or such.

openApiGenerate {
    generatorName = "kotlin"
    inputSpec = "$rootDir/specs/petstore-v3.0.yaml".toString()
    outputDir = "$buildDir/generated".toString()
    apiPackage = "org.openapi.example.api"
    invokerPackage = "org.openapi.example.invoker"
    modelPackage = "org.openapi.example.model"
    modelFilesConstrainedTo = [
            "Error"
    ]
    configOptions = [
        dateLibrary: "java8"
    ]
    cleanOutputDir = true
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the openapi-generator-gradle-plugin module and follow the openApiGenerate configuration entry point to where outputDir is processed before generation. Add the requested cleanOutputDir option, ensuring it removes the output directory contents before files are generated, and verify the Gradle plugin behavior with an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.