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"
|
rhino = "1.7.15"
|
||||||
settings = "1.0.0-RC"
|
settings = "1.0.0-RC"
|
||||||
twelvemonkeys = "3.9.4"
|
twelvemonkeys = "3.9.4"
|
||||||
graphqlkotlin = "6.5.6"
|
graphqlkotlin = "6.8.5"
|
||||||
xmlserialization = "0.86.2"
|
xmlserialization = "0.86.2"
|
||||||
ktlint = "1.3.1"
|
ktlint = "1.3.1"
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,15 @@ import com.expediagroup.graphql.server.types.GraphQLRequest
|
|||||||
import com.expediagroup.graphql.server.types.GraphQLServerRequest
|
import com.expediagroup.graphql.server.types.GraphQLServerRequest
|
||||||
import io.javalin.http.Context
|
import io.javalin.http.Context
|
||||||
import io.javalin.http.UploadedFile
|
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
|
import java.io.IOException
|
||||||
|
|
||||||
class JavalinGraphQLRequestParser : GraphQLRequestParser<Context> {
|
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? {
|
override suspend fun parseRequest(context: Context): GraphQLServerRequest? {
|
||||||
return try {
|
return try {
|
||||||
val contentType = context.contentType()
|
val contentType = context.contentType()
|
||||||
@@ -29,21 +33,18 @@ class JavalinGraphQLRequestParser : GraphQLRequestParser<Context> {
|
|||||||
context.formParam("operations")
|
context.formParam("operations")
|
||||||
?: throw IllegalArgumentException("Cannot find 'operations' body")
|
?: throw IllegalArgumentException("Cannot find 'operations' body")
|
||||||
} else {
|
} else {
|
||||||
return context.bodyAsClass(GraphQLServerRequest::class.java)
|
return Json.decodeFromStream<GraphQLServerRequest>(context.bodyAsInputStream())
|
||||||
}
|
}
|
||||||
|
|
||||||
val request =
|
val request =
|
||||||
context.jsonMapper().fromJsonString(
|
Json.decodeFromString<GraphQLServerRequest>(formParam)
|
||||||
formParam,
|
|
||||||
GraphQLServerRequest::class.java,
|
|
||||||
)
|
|
||||||
val map =
|
val map =
|
||||||
context
|
context
|
||||||
.formParam("map")
|
.formParam("map")
|
||||||
?.let {
|
?.let {
|
||||||
context.jsonMapper().fromJsonString(
|
Json.decodeFromString(
|
||||||
|
MapSerializer(String.serializer(), ListSerializer(String.serializer())),
|
||||||
it,
|
it,
|
||||||
Map::class.java as Class<Map<String, List<String>>>,
|
|
||||||
)
|
)
|
||||||
}.orEmpty()
|
}.orEmpty()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user