I'm currently experiencing a struggle with the OpenAPI Generator Plugin in Gradle. When I generate a new API Interface with the following settings in my build.gradle:
openApiGenerate {
generatorName = "spring"
inputSpec = "$rootDir/src/main/resources/api.yaml".toString()
outputDir = "$buildDir".toString()
apiPackage = "<package name>"
configOptions = [
interfaceOnly : "true",
library : "spring-cloud",
skipDefaultInterface: "true",
modelPackage : "<package name>",
apiPackage: "<package name>",
serializableModel: "true",
useOptional: "true",
]
}
The output API Interface uses generic Parameter names. For example var1, var2 and so on. Example:
ResponseEntity<Void> deleteOrganisationById(@ApiParam(value = "Mandant",required = true) @RequestHeader(value = "MANDANT",required = true) BigDecimal var1, @ApiParam(value = "ID of the organisation to be deleted",required = true) @PathVariable("id") String var2);
How can I change this so it uses some kind of talking names for the parameters? E.g. mandant for the MANDANT parameter etc.?
Just set the ensureUniqueParams
option to true
in the plugins configOptions.
Example pom.xml
:
<configOptions>
<ensureUniqueParams>true</ensureUniqueParams>
... other Parameters
</configOptions>