mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2025-12-10 06:42:07 +01:00
Update graphqlkotlin to v6.8.5 (#1064)
* Update graphqlkotlin to v6.8.5 * Replace Jackson with Kotlinx.Serialization where possible --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Syer10 <syer10@users.noreply.github.com>
This commit is contained in:
@@ -10,7 +10,7 @@ dex2jar = "v64" # Stuck until https://github.com/ThexXTURBOXx/dex2jar/issues/27
|
||||
rhino = "1.7.15"
|
||||
settings = "1.0.0-RC"
|
||||
twelvemonkeys = "3.9.4"
|
||||
graphqlkotlin = "6.5.6"
|
||||
graphqlkotlin = "6.8.5"
|
||||
xmlserialization = "0.86.2"
|
||||
ktlint = "1.3.1"
|
||||
|
||||
|
||||
@@ -13,11 +13,15 @@ import com.expediagroup.graphql.server.types.GraphQLRequest
|
||||
import com.expediagroup.graphql.server.types.GraphQLServerRequest
|
||||
import io.javalin.http.Context
|
||||
import io.javalin.http.UploadedFile
|
||||
import io.javalin.plugin.json.jsonMapper
|
||||
import kotlinx.serialization.builtins.ListSerializer
|
||||
import kotlinx.serialization.builtins.MapSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.decodeFromStream
|
||||
import java.io.IOException
|
||||
|
||||
class JavalinGraphQLRequestParser : GraphQLRequestParser<Context> {
|
||||
@Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE", "UNCHECKED_CAST")
|
||||
@Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")
|
||||
override suspend fun parseRequest(context: Context): GraphQLServerRequest? {
|
||||
return try {
|
||||
val contentType = context.contentType()
|
||||
@@ -29,21 +33,18 @@ class JavalinGraphQLRequestParser : GraphQLRequestParser<Context> {
|
||||
context.formParam("operations")
|
||||
?: throw IllegalArgumentException("Cannot find 'operations' body")
|
||||
} else {
|
||||
return context.bodyAsClass(GraphQLServerRequest::class.java)
|
||||
return Json.decodeFromStream<GraphQLServerRequest>(context.bodyAsInputStream())
|
||||
}
|
||||
|
||||
val request =
|
||||
context.jsonMapper().fromJsonString(
|
||||
formParam,
|
||||
GraphQLServerRequest::class.java,
|
||||
)
|
||||
Json.decodeFromString<GraphQLServerRequest>(formParam)
|
||||
val map =
|
||||
context
|
||||
.formParam("map")
|
||||
?.let {
|
||||
context.jsonMapper().fromJsonString(
|
||||
Json.decodeFromString(
|
||||
MapSerializer(String.serializer(), ListSerializer(String.serializer())),
|
||||
it,
|
||||
Map::class.java as Class<Map<String, List<String>>>,
|
||||
)
|
||||
}.orEmpty()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user