File tree Expand file tree Collapse file tree 3 files changed +9
-16
lines changed
expediagroup-sdk-openapi-plugin/src/main/kotlin/com/expediagroup/sdk/openapigenerator Expand file tree Collapse file tree 3 files changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ import org.gradle.api.Project
4646 * plugins { id("com.expediagroup.sdk.openapigenerator") }
4747 *
4848 * egSdkGenerator {
49- * namespace .set("cars ")
49+ * basePackage .set("com.expediagroup.sdk.example ")
5050 * specFilePath.set(layout.projectDirectory.file("specs/cars.yaml"))
5151 * customTemplatesDir.set(layout.projectDirectory.dir("my-templates"))
5252 * }
@@ -72,7 +72,6 @@ class EgSdkGeneratorPlugin : Plugin<Project> {
7272 it.dependsOn(mergeCustomTemplatesTask)
7373
7474 it.specFilePath.set(egSdkGeneratorExt.specFilePath)
75- it.namespace.set(egSdkGeneratorExt.namespace)
7675 it.objectMapper.set(egSdkGeneratorExt.objectMapper)
7776 it.customTemplatesDir.set(mergeCustomTemplatesTask.flatMap { mergeTask -> mergeTask.mergedDir })
7877 it.basePackage.set(egSdkGeneratorExt.basePackage)
Original file line number Diff line number Diff line change @@ -38,8 +38,8 @@ import org.openapitools.codegen.CodegenOperation
3838 *
3939 * ```kotlin
4040 * egSdkGenerator {
41+ * basePackage = "com.expediagroup.sdk.example"
4142 * specFilePath = layout.projectDirectory.file("specs/openapi.yaml")
42- * namespace = "rapid"
4343 * }
4444 * ```
4545 */
@@ -65,9 +65,6 @@ abstract class EgSdkGeneratorExtension(project: Project) : ExtensionAware {
6565 /* * Final destination directory for the generated Kotlin sources. */
6666 abstract val outputDir: DirectoryProperty
6767
68- /* * namespace (e.g. `"rapid"`) inserted into package names {basePackage}.{namespace} */
69- abstract val namespace: Property <String >
70-
7168 /* * User-supplied processors that post-process **operations** before templating. */
7269 abstract val operationProcessors: ListProperty < (CodegenOperation ) -> CodegenOperation >
7370
@@ -85,8 +82,8 @@ abstract class EgSdkGeneratorExtension(project: Project) : ExtensionAware {
8582
8683 init {
8784 // Default values
88- modelPackage.set(namespace .map { ns -> " com.expediagroup.sdk. $ns .model" })
89- operationPackage.set(namespace .map { ns -> " com.expediagroup.sdk. $ns .operation" })
85+ modelPackage.set(basePackage .map { bp -> " $bp .model" })
86+ operationPackage.set(basePackage .map { bp -> " $bp .operation" })
9087 outputDir.set(project.layout.projectDirectory.dir(" src/main/kotlin" ))
9188 }
9289}
Original file line number Diff line number Diff line change @@ -57,9 +57,6 @@ import kotlin.collections.joinToString
5757 * It allows customization of the generated code through various properties and templates.
5858 */
5959abstract class GenerateEgSdkTask : DefaultTask () {
60- @get:Input
61- abstract val namespace: Property <String >
62-
6360 @get:InputFile
6461 abstract val specFilePath: RegularFileProperty
6562
@@ -107,10 +104,11 @@ abstract class GenerateEgSdkTask : DefaultTask() {
107104
108105 @TaskAction
109106 fun generate () {
110- val supportingFilesNames = supportingTemplates.orNull
111- ?.joinToString(" ," ) { it.fileName }
112- .orEmpty()
113- .ifEmpty { " false" }
107+ val supportingFilesNames =
108+ supportingTemplates.orNull
109+ ?.joinToString(" ," ) { it.fileName }
110+ .orEmpty()
111+ .ifEmpty { " false" }
114112
115113 val config =
116114 CodegenConfigurator ().apply {
@@ -136,7 +134,6 @@ abstract class GenerateEgSdkTask : DefaultTask() {
136134 addGlobalProperty(CodegenConstants .SUPPORTING_FILES , supportingFilesNames)
137135
138136 // Additional Properties
139- addAdditionalProperty(" namespace" , namespace.get())
140137 addAdditionalProperty(" jacksonObjectMapper" , objectMapper.get())
141138 addAdditionalProperty(" modelPackage" , modelPackage.get())
142139 addAdditionalProperty(" operationPackage" , operationPackage.get())
You can’t perform that action at this time.
0 commit comments