File tree Expand file tree Collapse file tree 4 files changed +31
-24
lines changed
customizations/generator/openapi/src/main
kotlin/com/expediagroup/sdk/generators/openapi
resources/templates/expediagroup-sdk Expand file tree Collapse file tree 4 files changed +31
-24
lines changed Original file line number Diff line number Diff line change 1818
1919jobs :
2020 generate-and-publish-sources :
21- uses : ExpediaGroup/expediagroup-java-sdk/.github/workflows/selfserve-full-workflow.yaml@main
21+ uses : ExpediaGroup/expediagroup-java-sdk/.github/workflows/selfserve-full-workflow.yaml@v20241009
2222 secrets : inherit
2323 with :
2424 name : rapid
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ class OpenApiSdkGenerator {
100100 addGlobalProperty(CodegenConstants .MODELS , " " )
101101 addGlobalProperty(CodegenConstants .MODEL_DOCS , " false" )
102102
103- supportingFiles.add(" ${namespace} Client.kt" )
103+ supportingFiles.add(" ${namespace.pascalCase() } Client.kt" )
104104 addGlobalProperty(CodegenConstants .SUPPORTING_FILES , supportingFiles.joinToString(" ," ))
105105 // addGlobalProperty("debugSupportingFiles", "")
106106
@@ -135,7 +135,7 @@ class OpenApiSdkGenerator {
135135 SupportingFile (
136136 " client.mustache" ,
137137 " $packagePath /client/" ,
138- " ${namespace} Client.kt"
138+ " ${namespace.pascalCase() } Client.kt"
139139 )
140140 )
141141 add(SupportingFile (" pom.mustache" , " pom.xml" ))
Original file line number Diff line number Diff line change @@ -43,12 +43,12 @@ class {{clientClassname}}Client private constructor(clientConfiguration: RapidCl
4343 method = HttpMethod.parse(operation.method)
4444 url(operation.url)
4545
46- operation.params?.getHeaders()?.forEach { (key, value) - >
47- headers.append(key, value )
46+ operation.params?.getHeaders()?.let {
47+ headers.appendAll(it )
4848 }
4949
50- operation.params?.getQueryParams()?.forEach { (key, value) - >
51- url.parameters.appendAll(key, value )
50+ operation.params?.getQueryParams()?.let {
51+ url.parameters.appendAll(it )
5252 }
5353
5454 val extraHeaders = buildMap {
Original file line number Diff line number Diff line change 66 import com.expediagroup.sdk.core.model.OperationParams
77 import com.fasterxml.jackson.annotation.JsonProperty
88 import com.fasterxml.jackson.databind.annotation.JsonDeserialize
9+ import io.ktor.http.Headers
10+ import io.ktor.http.Parameters
911
1012 /**
1113 { {#nonBodyParams} }
135137 { {/hasRequiredParams} }
136138 }
137139
138- override fun getHeaders(): Map<String , String > {
139- return buildMap {
140+ fun toBuilder() = Builder(
141+ { {#nonBodyParams} }
142+ { {#params} }
143+ { {{paramName} }} = { {{paramName} }}{ {^-last} },{ {/-last} }
144+ { {/params} }
145+ { {/nonBodyParams} }
146+ )
147+
148+ override fun getHeaders(): Headers {
149+ return Headers.build {
140150 {{#headerParams} }
141- { {paramName} }?.also {
142- put (" {{baseName}}" , {{paramName } } { {#isEnum} }.value{ {/isEnum} })
151+ { {paramName} }?.let {
152+ append (" {{baseName}}" , it {{#isEnum} }.value{ {/isEnum} })
143153 }
144154 { {/headerParams} }
145155 { {#responses} }
146156 { {#httpAcceptHeader} }
147- put ("Accept", "{ {mediaTypes} }")
157+ append ("Accept", "{ {mediaTypes} }")
148158 { {/httpAcceptHeader} }
149159 { {/responses} }
150160 }
151161 }
152162
153- override fun getQueryParams(): Map< String , Iterable < String >> {
154- return buildMap {
163+ override fun getQueryParams(): Parameters {
164+ return Parameters.build {
155165 {{#queryParams} }
156- { {paramName} }?.also {
157- put(
158- " {{baseName}}" ,
159- {{#isContainer} }
160- { {paramName} }{ {#isEnum} }.map { it.value } { {/isEnum} }
161- { {/isContainer} }
162- { {^isContainer} }
163- listOf({ {paramName} }{ {#isEnum} }.value{ {/isEnum} }{ {^isString} }.toString(){ {/isString} })
164- { {/isContainer} }
165- )
166+ { {paramName} }?.let {
167+ {{#isContainer} }
168+ appendAll("{ {baseName} }", it{ {#isEnum} }.map { it.value } { {/isEnum} })
169+ { {/isContainer} }
170+ { {^isContainer} }
171+ append("{ {baseName} }", it{ {#isEnum} }.value{ {/isEnum} }{ {^isString} }.toString(){ {/isString} })
172+ { {/isContainer} }
166173 }
167174 { {/queryParams} }
168175 }
You can’t perform that action at this time.
0 commit comments