Skip to content

Commit c4928ed

Browse files
committed
fix template
1 parent d1f3558 commit c4928ed

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/_api_body.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{#hasAuthMethods}}
2-
{{>libraries/ktor/_principal}}
2+
{{>libraries/ktor2/_principal}}
33
{{#examples}}
44
{{#-first}}
55
{{#lambda.indented}}{{>_response}}{{/lambda.indented}}
@@ -12,10 +12,10 @@ call.respond(HttpStatusCode.NotImplemented)
1212
{{^hasAuthMethods}}
1313
{{#examples}}
1414
{{#-first}}
15-
{{>libraries/ktor/_response}}
15+
{{>libraries/ktor2/_response}}
1616
{{/-first}}
1717
{{/examples}}
1818
{{^examples}}
1919
call.respond(HttpStatusCode.NotImplemented)
2020
{{/examples}}
21-
{{/hasAuthMethods}}
21+
{{/hasAuthMethods}}

modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/api.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ fun Route.{{classname}}() {
3535
{{^featureResources}}
3636
route("{{path}}") {
3737
{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}} {
38-
{{#lambda.indented_12}}{{>libraries/ktor/_api_body}}{{/lambda.indented_12}}
38+
{{#lambda.indented_12}}{{>libraries/ktor2/_api_body}}{{/lambda.indented_12}}
3939
}
4040
}
4141
{{/featureResources}}
4242
{{#featureResources}}
4343
{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}<Paths.{{operationId}}> {
44-
{{#lambda.indented_8}}{{>libraries/ktor/_api_body}}{{/lambda.indented_8}}
44+
{{#lambda.indented_8}}{{>libraries/ktor2/_api_body}}{{/lambda.indented_8}}
4545
}
4646
{{/featureResources}}
4747
{{#hasAuthMethods}}

samples/server/petstore/kotlin-server/ktor2/src/main/kotlin/org/openapitools/server/apis/PetApi.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fun Route.PetApi() {
3636
authenticate("petstore_auth") {
3737
post<Paths.addPet> {
3838

39-
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
39+
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
4040

4141

4242
val exampleContentType = "application/json"
@@ -70,7 +70,7 @@ fun Route.PetApi() {
7070
authenticate("petstore_auth") {
7171
delete<Paths.deletePet> {
7272

73-
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
73+
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
7474

7575

7676
call.respond(HttpStatusCode.NotImplemented)
@@ -81,7 +81,7 @@ fun Route.PetApi() {
8181
authenticate("petstore_auth") {
8282
get<Paths.findPetsByStatus> {
8383

84-
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
84+
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
8585

8686

8787
val exampleContentType = "application/json"
@@ -131,7 +131,7 @@ fun Route.PetApi() {
131131
authenticate("petstore_auth") {
132132
get<Paths.findPetsByTags> {
133133

134-
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
134+
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
135135

136136

137137
val exampleContentType = "application/json"
@@ -181,7 +181,7 @@ fun Route.PetApi() {
181181
authenticate("api_key") {
182182
get<Paths.getPetById> {
183183

184-
val principal = call.authentication.principal<ApiPrincipal>()
184+
val principal = call.authentication.principal<ApiPrincipal>()!!
185185

186186

187187
val exampleContentType = "application/json"
@@ -215,7 +215,7 @@ fun Route.PetApi() {
215215
authenticate("petstore_auth") {
216216
put<Paths.updatePet> {
217217

218-
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
218+
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
219219

220220

221221
val exampleContentType = "application/json"
@@ -249,7 +249,7 @@ fun Route.PetApi() {
249249
authenticate("petstore_auth") {
250250
post<Paths.updatePetWithForm> {
251251

252-
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
252+
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
253253

254254

255255
call.respond(HttpStatusCode.NotImplemented)
@@ -260,7 +260,7 @@ fun Route.PetApi() {
260260
authenticate("petstore_auth") {
261261
post<Paths.uploadFile> {
262262

263-
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
263+
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
264264

265265

266266
val exampleContentType = "application/json"

samples/server/petstore/kotlin-server/ktor2/src/main/kotlin/org/openapitools/server/apis/StoreApi.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fun Route.StoreApi() {
4040
authenticate("api_key") {
4141
get<Paths.getInventory> {
4242

43-
val principal = call.authentication.principal<ApiPrincipal>()
43+
val principal = call.authentication.principal<ApiPrincipal>()!!
4444

4545

4646
call.respond(HttpStatusCode.NotImplemented)
@@ -60,7 +60,7 @@ fun Route.StoreApi() {
6060
}"""
6161

6262
when (exampleContentType) {
63-
"application/json" -> call.respondText(exampleContentType, ContentType.Application.Json)
63+
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
6464
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
6565
else -> call.respondText(exampleContentString)
6666
}
@@ -79,7 +79,7 @@ fun Route.StoreApi() {
7979
}"""
8080

8181
when (exampleContentType) {
82-
"application/json" -> call.respondText(exampleContentType, ContentType.Application.Json)
82+
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
8383
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
8484
else -> call.respondText(exampleContentString)
8585
}

samples/server/petstore/kotlin-server/ktor2/src/main/kotlin/org/openapitools/server/apis/UserApi.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fun Route.UserApi() {
3535
authenticate("api_key") {
3636
post<Paths.createUser> {
3737

38-
val principal = call.authentication.principal<ApiPrincipal>()
38+
val principal = call.authentication.principal<ApiPrincipal>()!!
3939

4040

4141
call.respond(HttpStatusCode.NotImplemented)
@@ -46,7 +46,7 @@ fun Route.UserApi() {
4646
authenticate("api_key") {
4747
post<Paths.createUsersWithArrayInput> {
4848

49-
val principal = call.authentication.principal<ApiPrincipal>()
49+
val principal = call.authentication.principal<ApiPrincipal>()!!
5050

5151

5252
call.respond(HttpStatusCode.NotImplemented)
@@ -57,7 +57,7 @@ fun Route.UserApi() {
5757
authenticate("api_key") {
5858
post<Paths.createUsersWithListInput> {
5959

60-
val principal = call.authentication.principal<ApiPrincipal>()
60+
val principal = call.authentication.principal<ApiPrincipal>()!!
6161

6262

6363
call.respond(HttpStatusCode.NotImplemented)
@@ -68,7 +68,7 @@ fun Route.UserApi() {
6868
authenticate("api_key") {
6969
delete<Paths.deleteUser> {
7070

71-
val principal = call.authentication.principal<ApiPrincipal>()
71+
val principal = call.authentication.principal<ApiPrincipal>()!!
7272

7373

7474
call.respond(HttpStatusCode.NotImplemented)
@@ -90,7 +90,7 @@ fun Route.UserApi() {
9090
}"""
9191

9292
when (exampleContentType) {
93-
"application/json" -> call.respondText(exampleContentType, ContentType.Application.Json)
93+
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
9494
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
9595
else -> call.respondText(exampleContentString)
9696
}
@@ -105,7 +105,7 @@ fun Route.UserApi() {
105105
authenticate("api_key") {
106106
get<Paths.logoutUser> {
107107

108-
val principal = call.authentication.principal<ApiPrincipal>()
108+
val principal = call.authentication.principal<ApiPrincipal>()!!
109109

110110

111111
call.respond(HttpStatusCode.NotImplemented)
@@ -116,7 +116,7 @@ fun Route.UserApi() {
116116
authenticate("api_key") {
117117
put<Paths.updateUser> {
118118

119-
val principal = call.authentication.principal<ApiPrincipal>()
119+
val principal = call.authentication.principal<ApiPrincipal>()!!
120120

121121

122122
call.respond(HttpStatusCode.NotImplemented)

0 commit comments

Comments
 (0)