Skip to content

Commit e4fa1b5

Browse files
committed
feat: enable using enums in headers, use partial imports in operation params template
1 parent a170680 commit e4fa1b5

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

customizations/generator/openapi/src/main/resources/templates/expediagroup-sdk/operation_params.mustache

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,7 @@
33
{{#hasNonBodyParams}}
44
package com.expediagroup.sdk.{{namespace}}.operations
55

6-
import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException
7-
import com.expediagroup.sdk.core.model.OperationParams
8-
9-
import com.fasterxml.jackson.annotation.JsonProperty
10-
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
11-
import io.ktor.http.Headers
12-
import io.ktor.http.Parameters
13-
14-
import javax.validation.constraints.Max
15-
import javax.validation.constraints.Min
16-
import javax.validation.constraints.NotNull
17-
import javax.validation.constraints.Pattern
18-
import javax.validation.constraints.Size
19-
import javax.validation.Valid
20-
import javax.validation.Validation
21-
22-
import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator
6+
{{>imports/operation_params}}
237

248
/**
259
{{#nonBodyParams}}
@@ -167,7 +151,13 @@
167151
return Headers.build {
168152
{{#headerParams}}
169153
{{paramName}}?.let {
170-
append("{{baseName}}", it{{#isEnum}}.value{{/isEnum}})
154+
append(
155+
"{{baseName}}",
156+
it
157+
{{#isEnum}}.value{{/isEnum}}
158+
{{^isEnum}}{{#isEnumRef}}.value{{/isEnumRef}}{{/isEnum}}
159+
{{#isUuid}}.toString(){{/isUuid}}
160+
)
171161
}
172162
{{/headerParams}}
173163
{{#responses}}

0 commit comments

Comments
 (0)