Skip to content

Commit 878b96b

Browse files
committed
Fix deserialization for ktor and ktor2 into Any and use calendar year
1 parent d7d0b97 commit 878b96b

21 files changed

Lines changed: 24 additions & 52 deletions

File tree

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ import {{packageName}}.infrastructure.ApiPrincipal
2222

2323
{{#operations}}
2424
fun Route.{{classname}}() {
25-
val empty = mutableMapOf<String, Any?>()
26-
2725
{{#operation}}
2826
{{#hasAuthMethods}}
2927
{{#authMethods}}

modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor/logback.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<configuration>
22
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
33
<encoder>
4-
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
4+
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
55
</encoder>
66
</appender>
77

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ val exampleContentType = "{{{contentType}}}"
22
val exampleContentString = """{{&example}}"""
33

44
when (exampleContentType) {
5-
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
5+
"application/json" -> call.respond(gson.fromJson(exampleContentString, Any::class.java))
66
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
77
else -> call.respondText(exampleContentString)
88
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ import {{packageName}}.infrastructure.ApiPrincipal
2424
{{#operations}}
2525
fun Route.{{classname}}() {
2626
val gson = Gson()
27-
val empty = mutableMapOf<String, Any?>()
28-
2927
{{#operation}}
3028
{{#hasAuthMethods}}
3129
{{#authMethods}}

modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/logback.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<configuration>
22
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
33
<encoder>
4-
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
4+
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
55
</encoder>
66
</appender>
77

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import org.openapitools.server.models.ModelApiResponse
2929
import org.openapitools.server.models.Pet
3030

3131
fun Route.PetApi() {
32-
val empty = mutableMapOf<String, Any?>()
33-
3432
authenticate("petstore_auth") {
3533
post<Paths.addPet> {
3634

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ import org.openapitools.server.infrastructure.ApiPrincipal
2828
import org.openapitools.server.models.Order
2929

3030
fun Route.StoreApi() {
31-
val empty = mutableMapOf<String, Any?>()
32-
3331
delete<Paths.deleteOrder> {
3432
call.respond(HttpStatusCode.NotImplemented)
3533

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ import org.openapitools.server.infrastructure.ApiPrincipal
2828
import org.openapitools.server.models.User
2929

3030
fun Route.UserApi() {
31-
val empty = mutableMapOf<String, Any?>()
32-
3331
post<Paths.createUser> {
3432
call.respond(HttpStatusCode.NotImplemented)
3533

samples/server/petstore/kotlin-server-modelMutable/src/main/resources/logback.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<configuration>
22
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
33
<encoder>
4-
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
4+
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
55
</encoder>
66
</appender>
77

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import org.openapitools.server.models.ModelApiResponse
2929
import org.openapitools.server.models.Pet
3030

3131
fun Route.PetApi() {
32-
val empty = mutableMapOf<String, Any?>()
33-
3432
authenticate("petstore_auth") {
3533
post<Paths.addPet> {
3634

0 commit comments

Comments
 (0)