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"
]
}
A bit late but always good to give a good answer.
You have to use the configOption skipDefaultInterface but you also need to set the property generateSupportingFiles to false (which is NOT one of the configOptions but goes directly under configuration)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With