Skip to content

Commit d69a667

Browse files
authored
Ignore unknown keys in request JSON (#127)
* Ignore Unknown keys in request JSON * Fix test data class name * Fix coverage
1 parent a8fbbb0 commit d69a667

File tree

4 files changed

+80
-45
lines changed

4 files changed

+80
-45
lines changed

kotlin/local-data-api/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ jacocoTestReport {
7474
'**/localDataApi/SqlParameter.class',
7575
'**/localDataApi/DataAPIException.class',
7676
'**/localDataApi/ApplicationKt.class',
77+
'**/localDataApi/Field.class',
7778
]
7879
)
7980
}))

kotlin/local-data-api/src/com/koxudaxi/localDataApi/Application.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import io.ktor.response.*
77
import io.ktor.request.*
88
import io.ktor.routing.*
99
import io.ktor.serialization.*
10+
import kotlinx.serialization.json.Json
1011
import java.sql.ResultSet
1112
import java.sql.SQLException
1213
import java.sql.Statement
@@ -25,7 +26,7 @@ val secretManager = SecretManager.INSTANCE
2526
fun Application.module(testing: Boolean = false) {
2627
setup()
2728
install(ContentNegotiation) {
28-
json(DefaultJson, ContentType.Any)
29+
json(Json { ignoreUnknownKeys = true }, ContentType.Any)
2930
}
3031
install(StatusPages) {
3132
exception<SQLException> { cause ->

0 commit comments

Comments
 (0)