I have am using openapi-generator-gradle-plugin:4.3.0
to generate the api and models from a openApi-generate.yaml
file. I have set skipDefaultInterface: "true"
in configOptions, the default implementation of interfaces is not generated and ApiUtil.java
is not used anywhere. (The default implementations used ApiUtil.java
)
What I want is to remove (disable the generation of) ApiUtil.java
from generated_sources, as it is not used in code, and its default code is creating security-issues in pipeline as well.
What I have tried: I have tried adding different options::
supportingFilesConstrainedTo = []
supportingFiles = ""
supportingFilesToGenerate = ""
apiFilesConstrainedTo = []
But I haven't been able to remove this file from being generated. I went through this: OpenApi generation Customization, but looks like it is not applicable for the given version.
Current gradle buildscript looks as:
task generateTask(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
generatorName = "spring"
inputSpec = "$projectDir/src/main/resources/specs/openApi-generate.yaml"
outputDir = "$buildDir/generated-sources"
apiPackage = "com.example.openapi.api"
modelPackage = "com.example.openapi.model"
generateModelDocumentation = false
generateApiDocumentation = false
generateModelTests = false
generateApiTests = false
configOptions = [
dateLibrary: "java8",
interfaceOnly: "true",
serializableModel: "true",
skipDefaultInterface: "true"
]
}
Answering my own question. I had to do following things:
id "org.openapi.generator" version 5.3.1
globalProperties = [
apis : ""
]