I am using openapi generator to generate the interface and models from openapi specification. Everything is working fine. But, I want to have suffix in my model name. For example: Employee would be EmployeeDTO. I have added “modelSuffix” in configOptions in openApiGenerate config in my grade as follows.
<code>openApiGenerate {
generatorName = 'spring'
inputSpec = file('src/main/resources/api-spec/api.yaml').absolutePath
outputDir = file('build/generated').absolutePath
apiPackage = 'com.abhi.api'
modelPackage = 'com.abhi.model'
invokerPackage = 'com.abhi.invoker'
configOptions = [
interfaceOnly: 'true',
useOptional: 'false',
dateLibrary: 'java8',
implementationPackage: '', // Prevent generation of implementation classes
skipDefaultInterface: 'true', // Skip generation of default methods
modelSuffix: 'DTO',
useTags: 'true',
]
}
</code>
<code>openApiGenerate {
generatorName = 'spring'
inputSpec = file('src/main/resources/api-spec/api.yaml').absolutePath
outputDir = file('build/generated').absolutePath
apiPackage = 'com.abhi.api'
modelPackage = 'com.abhi.model'
invokerPackage = 'com.abhi.invoker'
configOptions = [
interfaceOnly: 'true',
useOptional: 'false',
dateLibrary: 'java8',
implementationPackage: '', // Prevent generation of implementation classes
skipDefaultInterface: 'true', // Skip generation of default methods
modelSuffix: 'DTO',
useTags: 'true',
]
}
</code>
openApiGenerate {
generatorName = 'spring'
inputSpec = file('src/main/resources/api-spec/api.yaml').absolutePath
outputDir = file('build/generated').absolutePath
apiPackage = 'com.abhi.api'
modelPackage = 'com.abhi.model'
invokerPackage = 'com.abhi.invoker'
configOptions = [
interfaceOnly: 'true',
useOptional: 'false',
dateLibrary: 'java8',
implementationPackage: '', // Prevent generation of implementation classes
skipDefaultInterface: 'true', // Skip generation of default methods
modelSuffix: 'DTO',
useTags: 'true',
]
}
But it doesn’t have effect. Could you please give me any solution?