Skip to content

Commit

Permalink
fix template
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed Dec 14, 2024
1 parent d1f3558 commit c4928ed
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#hasAuthMethods}}
{{>libraries/ktor/_principal}}
{{>libraries/ktor2/_principal}}
{{#examples}}
{{#-first}}
{{#lambda.indented}}{{>_response}}{{/lambda.indented}}
Expand All @@ -12,10 +12,10 @@ call.respond(HttpStatusCode.NotImplemented)
{{^hasAuthMethods}}
{{#examples}}
{{#-first}}
{{>libraries/ktor/_response}}
{{>libraries/ktor2/_response}}
{{/-first}}
{{/examples}}
{{^examples}}
call.respond(HttpStatusCode.NotImplemented)
{{/examples}}
{{/hasAuthMethods}}
{{/hasAuthMethods}}
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ fun Route.{{classname}}() {
{{^featureResources}}
route("{{path}}") {
{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}} {
{{#lambda.indented_12}}{{>libraries/ktor/_api_body}}{{/lambda.indented_12}}
{{#lambda.indented_12}}{{>libraries/ktor2/_api_body}}{{/lambda.indented_12}}
}
}
{{/featureResources}}
{{#featureResources}}
{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}<Paths.{{operationId}}> {
{{#lambda.indented_8}}{{>libraries/ktor/_api_body}}{{/lambda.indented_8}}
{{#lambda.indented_8}}{{>libraries/ktor2/_api_body}}{{/lambda.indented_8}}
}
{{/featureResources}}
{{#hasAuthMethods}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fun Route.PetApi() {
authenticate("petstore_auth") {
post<Paths.addPet> {

val principal = call.authentication.principal<OAuthAccessTokenResponse>()
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!


val exampleContentType = "application/json"
Expand Down Expand Up @@ -70,7 +70,7 @@ fun Route.PetApi() {
authenticate("petstore_auth") {
delete<Paths.deletePet> {

val principal = call.authentication.principal<OAuthAccessTokenResponse>()
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!


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

val principal = call.authentication.principal<OAuthAccessTokenResponse>()
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!


val exampleContentType = "application/json"
Expand Down Expand Up @@ -131,7 +131,7 @@ fun Route.PetApi() {
authenticate("petstore_auth") {
get<Paths.findPetsByTags> {

val principal = call.authentication.principal<OAuthAccessTokenResponse>()
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!


val exampleContentType = "application/json"
Expand Down Expand Up @@ -181,7 +181,7 @@ fun Route.PetApi() {
authenticate("api_key") {
get<Paths.getPetById> {

val principal = call.authentication.principal<ApiPrincipal>()
val principal = call.authentication.principal<ApiPrincipal>()!!


val exampleContentType = "application/json"
Expand Down Expand Up @@ -215,7 +215,7 @@ fun Route.PetApi() {
authenticate("petstore_auth") {
put<Paths.updatePet> {

val principal = call.authentication.principal<OAuthAccessTokenResponse>()
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!


val exampleContentType = "application/json"
Expand Down Expand Up @@ -249,7 +249,7 @@ fun Route.PetApi() {
authenticate("petstore_auth") {
post<Paths.updatePetWithForm> {

val principal = call.authentication.principal<OAuthAccessTokenResponse>()
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!


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

val principal = call.authentication.principal<OAuthAccessTokenResponse>()
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!


val exampleContentType = "application/json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fun Route.StoreApi() {
authenticate("api_key") {
get<Paths.getInventory> {

val principal = call.authentication.principal<ApiPrincipal>()
val principal = call.authentication.principal<ApiPrincipal>()!!


call.respond(HttpStatusCode.NotImplemented)
Expand All @@ -60,7 +60,7 @@ fun Route.StoreApi() {
}"""

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

when (exampleContentType) {
"application/json" -> call.respondText(exampleContentType, ContentType.Application.Json)
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
else -> call.respondText(exampleContentString)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fun Route.UserApi() {
authenticate("api_key") {
post<Paths.createUser> {

val principal = call.authentication.principal<ApiPrincipal>()
val principal = call.authentication.principal<ApiPrincipal>()!!


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

val principal = call.authentication.principal<ApiPrincipal>()
val principal = call.authentication.principal<ApiPrincipal>()!!


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

val principal = call.authentication.principal<ApiPrincipal>()
val principal = call.authentication.principal<ApiPrincipal>()!!


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

val principal = call.authentication.principal<ApiPrincipal>()
val principal = call.authentication.principal<ApiPrincipal>()!!


call.respond(HttpStatusCode.NotImplemented)
Expand All @@ -90,7 +90,7 @@ fun Route.UserApi() {
}"""

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

val principal = call.authentication.principal<ApiPrincipal>()
val principal = call.authentication.principal<ApiPrincipal>()!!


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

val principal = call.authentication.principal<ApiPrincipal>()
val principal = call.authentication.principal<ApiPrincipal>()!!


call.respond(HttpStatusCode.NotImplemented)
Expand Down

0 comments on commit c4928ed

Please sign in to comment.