diff --git a/generator/pom.xml b/generator/pom.xml index 22dc9bf9..378373bb 100644 --- a/generator/pom.xml +++ b/generator/pom.xml @@ -45,7 +45,7 @@ 3.5.0 - 3.2.0 + 3.3.0 3.13.0 3.4.2 3.3.1 diff --git a/generator/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Discriminator.kt b/generator/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Discriminator.kt index ad53b8fe..9308f81b 100644 --- a/generator/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Discriminator.kt +++ b/generator/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Discriminator.kt @@ -23,15 +23,14 @@ internal data class Discriminator( val value: String, ) -internal fun getParentDiscriminator(model: CodegenModel): Discriminator? { - return model.parentModel?.discriminator?.let { +internal fun getParentDiscriminator(model: CodegenModel): Discriminator? = + model.parentModel?.discriminator?.let { Discriminator( it.propertyBaseName, it.propertyName, it.mappedModels.find { mappedModel -> mappedModel.modelName.equals(model.classname) }!!.mappingName, ) } -} internal fun getDiscriminators(model: CodegenModel): MutableList { val discriminators: MutableList = model.parentModel?.let { getDiscriminators(model.parentModel) } ?: mutableListOf() diff --git a/generator/src/main/kotlin/com/expediagroup/sdk/generators/openapi/ModelTemplate.kt b/generator/src/main/kotlin/com/expediagroup/sdk/generators/openapi/ModelTemplate.kt index 36379390..5047968e 100644 --- a/generator/src/main/kotlin/com/expediagroup/sdk/generators/openapi/ModelTemplate.kt +++ b/generator/src/main/kotlin/com/expediagroup/sdk/generators/openapi/ModelTemplate.kt @@ -18,7 +18,10 @@ package com.expediagroup.sdk.generators.openapi import org.openapitools.codegen.api.TemplateDefinition import org.openapitools.codegen.api.TemplateFileType.Model -class ModelTemplate(templateFile: String, destinationFilename: String) : TemplateDefinition(templateFile, destinationFilename) { +class ModelTemplate( + templateFile: String, + destinationFilename: String, +) : TemplateDefinition(templateFile, destinationFilename) { init { templateType = Model } diff --git a/generator/src/main/kotlin/com/expediagroup/sdk/generators/openapi/MustacheHelpers.kt b/generator/src/main/kotlin/com/expediagroup/sdk/generators/openapi/MustacheHelpers.kt index dd2e679a..e1a5576d 100644 --- a/generator/src/main/kotlin/com/expediagroup/sdk/generators/openapi/MustacheHelpers.kt +++ b/generator/src/main/kotlin/com/expediagroup/sdk/generators/openapi/MustacheHelpers.kt @@ -66,11 +66,12 @@ val mustacheHelpers = model.parentModel?.let { val discriminators: MutableList = getDiscriminators(model) writer.write("super({\n") - it.allVars.filterNot { variable -> - variable.isDiscriminator || discriminators.contains(variable.baseName) - }.forEach { variable -> - writer.write("${variable.name}: ${model.classVarName}.${variable.name},\n") - } + it.allVars + .filterNot { variable -> + variable.isDiscriminator || discriminators.contains(variable.baseName) + }.forEach { variable -> + writer.write("${variable.name}: ${model.classVarName}.${variable.name},\n") + } writer.write("})") } } diff --git a/generator/src/main/kotlin/com/expediagroup/sdk/model/Exception.kt b/generator/src/main/kotlin/com/expediagroup/sdk/model/Exception.kt index 6ca30940..14b9aa08 100644 --- a/generator/src/main/kotlin/com/expediagroup/sdk/model/Exception.kt +++ b/generator/src/main/kotlin/com/expediagroup/sdk/model/Exception.kt @@ -15,8 +15,17 @@ */ package com.expediagroup.sdk.model -open class GeneratorException(message: String, cause: Throwable? = null) : RuntimeException(message, cause) +open class GeneratorException( + message: String, + cause: Throwable? = null, +) : RuntimeException(message, cause) -class ClientGenerationException(message: String, cause: Throwable? = null) : GeneratorException(message, cause) +class ClientGenerationException( + message: String, + cause: Throwable? = null, +) : GeneratorException(message, cause) -class PreProcessingException(message: String, cause: Throwable? = null) : GeneratorException(message, cause) +class PreProcessingException( + message: String, + cause: Throwable? = null, +) : GeneratorException(message, cause)