Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/core/main/typescript…
Browse files Browse the repository at this point in the history
…-5.7.2
  • Loading branch information
anssari1 authored Dec 1, 2024
2 parents 7b96717 + 72f438c commit 07533e5
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 23 deletions.
4 changes: 2 additions & 2 deletions generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
<sdkVersion>0.0.1-SNAPSHOT</sdkVersion>

<!-- Versions -->
<kotlin.version>2.0.21</kotlin.version>
<kotlin.version>2.1.0</kotlin.version>
<openapi-generator.version>7.10.0</openapi-generator.version>

<!-- Plugin Versions -->
<exec-maven-plugin.version>3.5.0</exec-maven-plugin.version>
<ktlint-plugin.version>3.2.0</ktlint-plugin.version>
<ktlint-plugin.version>3.3.0</ktlint-plugin.version>
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> {
val discriminators: MutableList<String> = model.parentModel?.let { getDiscriminators(model.parentModel) } ?: mutableListOf()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ val mustacheHelpers =
model.parentModel?.let {
val discriminators: MutableList<String> = 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("})")
}
}
Expand Down
15 changes: 12 additions & 3 deletions generator/src/main/kotlin/com/expediagroup/sdk/model/Exception.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions generator/src/main/resources/dependencies/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"devDependencies": {
"prettier": "3.4.1",
"prettier-plugin-organize-imports": "4.1.0",
"typedoc": "0.26.11",
"typedoc-plugin-markdown": "4.2.10",
"typedoc": "0.27.1",
"typedoc-plugin-markdown": "4.3.0",
"typedoc-plugin-missing-exports": "3.1.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"excludeInternal": true,
"excludeExternals": true,
"excludeReferences": true,
"hideParameterTypesInTitle": true,
"hideGenerator": true,
"githubPages": false,
"readme": "none",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#### Parameters

**configurations**: [`ClientConfigurations`](../core/interfaces/ClientConfigurations.md)
##### configurations

[`ClientConfigurations`](../core/interfaces/ClientConfigurations.md)

#### Returns

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
#### Parameters

**endpoint**: `string` = `Constant.ENDPOINT`
##### endpoint

**requestTimeout**: `number` = `Constant.TEN_SECONDS_IN_MILLIS`
`string` = `Constant.ENDPOINT`

##### requestTimeout

`number` = `Constant.TEN_SECONDS_IN_MILLIS`

#### Returns

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ The object used to describe a cause for an error, containing both human-readable
#### Parameters

**errorCause**: [`ErrorCauseProperties`](../interfaces/ErrorCauseProperties.md)
##### errorCause

[`ErrorCauseProperties`](../interfaces/ErrorCauseProperties.md)

#### Returns

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#### Parameters

**greeting**: [`GreetingProperties`](../interfaces/GreetingProperties.md)
##### greeting

[`GreetingProperties`](../interfaces/GreetingProperties.md)

#### Returns

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ The object used the describe an error, containing both human-readable and in a m
#### Parameters

**error**: [`ModelErrorProperties`](../interfaces/ModelErrorProperties.md)
##### error

[`ModelErrorProperties`](../interfaces/ModelErrorProperties.md)

#### Returns

Expand Down

0 comments on commit 07533e5

Please sign in to comment.