Open ShishkinDmitriy opened 3 years ago
@ShishkinDmitriy, unfortunately boolean flags is main plague of openapi-generator
UPD: please find gradle task with minimal leftovers (sadly some support files as still generated, just gitignore them) used with openapi gradle plugin 6.2.1
task generateXServerApi(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
group = 'openapi tools'
description = 'X API'
validateSpec = true
generatorName = 'spring'
inputSpec = "$rootDir/misc/openapi/x_api.yml"
outputDir = sourceSets.generatedXApi.java.srcDirs.first() as String
apiFilesConstrainedTo = ['']
modelFilesConstrainedTo = ['']
supportingFilesConstrainedTo = ['ApiUtil.java']
apiPackage = "${project.group}.${project.name}.api"
modelPackage = "${project.group}.${project.name}.api.dto"
modelNameSuffix = 'ApiDto'
configOptions = [
library : 'spring-boot',
sourceFolder : '',
skipOverwrite : false,
skipDefaultInterface : false,
interfaceOnly : true,
useTags : true,
hideGenerationTimestamp: true,
documentationProvider : 'none',
useBeanValidation : true,
performBeanValidation : true,
enumUnknownDefaultCase : true,
].collectEntries { [it.key, it.value as String] }
additionalProperties = [
useSpringfox : false,
openApiNullable: false,
useSpringBoot3 : true,
].collectEntries { [it.key, it.value as String] }
tasks.compileJava.dependsOn it
}
Is your feature request related to a problem? Please describe.
I am trying to generate spring project with
apiFirst = true
. And I see it doesn't generate api and models, only delegates and home controller to serve openapi json and yaml files. As I understand it is because of these lines: https://github.com/OpenAPITools/openapi-generator/blob/c974c512ff590c797db9f3e93c079017d65d3dcd/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java#L411-L414Describe the solution you'd like
I think if it is api-first solution apis and models should be generated from yaml. Also plugin
openapi-generator-maven-plugin
already has controls which can be used for same control:generateApis
,generateModels
.