From 97834b33f1062abd91e58c78b89450e1f9617082 Mon Sep 17 00:00:00 2001 From: magr Date: Wed, 29 Sep 2021 10:13:21 +0200 Subject: [PATCH 01/11] unique key for feature --- .../src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt b/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt index 23ac8325..679568c0 100644 --- a/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt +++ b/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt @@ -12,6 +12,7 @@ import io.ktor.util.* import kotlinx.coroutines.coroutineScope import kotlinx.serialization.json.* import kotlinx.serialization.json.Json.Default.decodeFromString +import java.util.* class GraphQL(val schema: Schema) { @@ -41,9 +42,8 @@ class GraphQL(val schema: Schema) { } - companion object Feature: ApplicationFeature { - override val key = AttributeKey("KGraphQL") + override val key = AttributeKey("KGraphQL-" + UUID.randomUUID()) override fun install(pipeline: Application, configure: Configuration.() -> Unit): GraphQL { val config = Configuration().apply(configure) From be9657d3db23a72affcfbd3d19eae7db25f5f988 Mon Sep 17 00:00:00 2001 From: magr Date: Wed, 29 Sep 2021 10:20:55 +0200 Subject: [PATCH 02/11] singing --- build.gradle.kts | 28 ----------------- kgraphql-example/build.gradle.kts | 48 ----------------------------- kgraphql-ktor/build.gradle.kts | 48 ----------------------------- kgraphql/build.gradle.kts | 50 +------------------------------ 4 files changed, 1 insertion(+), 173 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 965f79b6..4abdb4f8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,14 +1,9 @@ -import de.marcphilipp.gradle.nexus.NexusPublishPlugin import java.time.Duration val version: String by project -val sonatypeUsername: String? = System.getenv("sonatypeUsername") -val sonatypePassword: String? = System.getenv("sonatypePassword") plugins { id("com.github.ben-manes.versions") version "0.39.0" - id("io.codearte.nexus-staging") version "0.30.0" - id("de.marcphilipp.nexus-publish") version "0.4.0" jacoco } @@ -21,33 +16,10 @@ allprojects { subprojects { group = "com.apurebase" version = version - - apply() - - nexusPublishing { - repositories { - sonatype() - } - clientTimeout.set(Duration.parse("PT10M")) // 10 minutes - } -} - -nexusStaging { - packageGroup = "com.apurebase" - username = sonatypeUsername - password = sonatypePassword - numberOfRetries = 360 // 1 hour if 10 seconds delay - delayBetweenRetriesInMillis = 10000 // 10 seconds } tasks { wrapper { distributionType = Wrapper.DistributionType.ALL } - closeRepository { - mustRunAfter(subprojects.map { it.tasks.getByName("publishToSonatype") }.toTypedArray()) - } - closeAndReleaseRepository { - mustRunAfter(subprojects.map { it.tasks.getByName("publishToSonatype") }.toTypedArray()) - } } diff --git a/kgraphql-example/build.gradle.kts b/kgraphql-example/build.gradle.kts index 441cfeee..1e98f89b 100644 --- a/kgraphql-example/build.gradle.kts +++ b/kgraphql-example/build.gradle.kts @@ -62,51 +62,3 @@ val dokkaJar by tasks.creating(Jar::class) { classifier = "javadoc" from(tasks.dokkaHtml) } - -publishing { - publications { - create("maven") { - artifactId = project.name - from(components["java"]) - artifact(sourcesJar) - artifact(dokkaJar) - pom { - name.set("KGraphQL") - description.set("KGraphQL is a Kotlin implementation of GraphQL. It provides a rich DSL to set up the GraphQL schema.") - url.set("https://kgraphql.io/") - organization { - name.set("aPureBase") - url.set("http://apurebase.com/") - } - licenses { - license { - name.set("MIT License") - url.set("https://github.com/aPureBase/KGraphQL/blob/main/LICENSE.md") - } - } - developers { - developer { - id.set("jeggy") - name.set("Jógvan Olsen") - email.set("jol@apurebase.com") - } - } - scm { - connection.set("scm:git:https://github.com/aPureBase/KGraphQL.git") - developerConnection.set("scm:git:https://github.com/aPureBase/KGraphQL.git") - url.set("https://github.com/aPureBase/KGraphQL/") - tag.set("HEAD") - } - } - } - } -} - -signing { - isRequired = isReleaseVersion - useInMemoryPgpKeys( - System.getenv("ORG_GRADLE_PROJECT_signingKey"), - System.getenv("ORG_GRADLE_PROJECT_signingPassword") - ) - sign(publishing.publications["maven"]) -} diff --git a/kgraphql-ktor/build.gradle.kts b/kgraphql-ktor/build.gradle.kts index 5b15a615..0e3b1ee0 100644 --- a/kgraphql-ktor/build.gradle.kts +++ b/kgraphql-ktor/build.gradle.kts @@ -66,51 +66,3 @@ val dokkaJar by tasks.creating(Jar::class) { classifier = "javadoc" from(tasks.dokkaHtml) } - -publishing { - publications { - create("maven") { - artifactId = project.name - from(components["java"]) - artifact(sourcesJar) - artifact(dokkaJar) - pom { - name.set("KGraphQL") - description.set("KGraphQL is a Kotlin implementation of GraphQL. It provides a rich DSL to set up the GraphQL schema.") - url.set("https://kgraphql.io/") - organization { - name.set("aPureBase") - url.set("http://apurebase.com/") - } - licenses { - license { - name.set("MIT License") - url.set("https://github.com/aPureBase/KGraphQL/blob/main/LICENSE.md") - } - } - developers { - developer { - id.set("jeggy") - name.set("Jógvan Olsen") - email.set("jol@apurebase.com") - } - } - scm { - connection.set("scm:git:https://github.com/aPureBase/KGraphQL.git") - developerConnection.set("scm:git:https://github.com/aPureBase/KGraphQL.git") - url.set("https://github.com/aPureBase/KGraphQL/") - tag.set("HEAD") - } - } - } - } -} - -signing { - isRequired = isReleaseVersion - useInMemoryPgpKeys( - System.getenv("ORG_GRADLE_PROJECT_signingKey"), - System.getenv("ORG_GRADLE_PROJECT_signingPassword") - ) - sign(publishing.publications["maven"]) -} diff --git a/kgraphql/build.gradle.kts b/kgraphql/build.gradle.kts index e420407d..f8b6bc89 100644 --- a/kgraphql/build.gradle.kts +++ b/kgraphql/build.gradle.kts @@ -74,52 +74,4 @@ val dokkaJar by tasks.creating(Jar::class) { group = JavaBasePlugin.DOCUMENTATION_GROUP classifier = "javadoc" from(tasks.dokkaHtml) -} - -publishing { - publications { - create("maven") { - artifactId = project.name - from(components["java"]) - artifact(sourcesJar) - artifact(dokkaJar) - pom { - name.set("KGraphQL") - description.set("KGraphQL is a Kotlin implementation of GraphQL. It provides a rich DSL to set up the GraphQL schema.") - url.set("https://kgraphql.io/") - organization { - name.set("aPureBase") - url.set("http://apurebase.com/") - } - licenses { - license { - name.set("MIT License") - url.set("https://github.com/aPureBase/KGraphQL/blob/main/LICENSE.md") - } - } - developers { - developer { - id.set("jeggy") - name.set("Jógvan Olsen") - email.set("jol@apurebase.com") - } - } - scm { - connection.set("scm:git:https://github.com/aPureBase/KGraphQL.git") - developerConnection.set("scm:git:https://github.com/aPureBase/KGraphQL.git") - url.set("https://github.com/aPureBase/KGraphQL/") - tag.set("HEAD") - } - } - } - } -} - -signing { - isRequired = isReleaseVersion - useInMemoryPgpKeys( - System.getenv("ORG_GRADLE_PROJECT_signingKey"), - System.getenv("ORG_GRADLE_PROJECT_signingPassword") - ) - sign(publishing.publications["maven"]) -} +} \ No newline at end of file From 379cee22c795d2426f908434dcd663587446d933 Mon Sep 17 00:00:00 2001 From: magr Date: Wed, 29 Sep 2021 10:31:31 +0200 Subject: [PATCH 03/11] add maven plugin --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 4abdb4f8..d23139a7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,9 @@ -import java.time.Duration val version: String by project plugins { id("com.github.ben-manes.versions") version "0.39.0" + id("maven") jacoco } From a1bd8be35a7d0d5b086f51382d9da892fe262810 Mon Sep 17 00:00:00 2001 From: magr Date: Wed, 29 Sep 2021 10:36:51 +0200 Subject: [PATCH 04/11] more maven-publish plugin --- build.gradle.kts | 2 +- kgraphql-ktor/build.gradle.kts | 1 + kgraphql/build.gradle.kts | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index d23139a7..f52cb641 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ val version: String by project plugins { id("com.github.ben-manes.versions") version "0.39.0" - id("maven") + id("maven-publish") jacoco } diff --git a/kgraphql-ktor/build.gradle.kts b/kgraphql-ktor/build.gradle.kts index 0e3b1ee0..11999547 100644 --- a/kgraphql-ktor/build.gradle.kts +++ b/kgraphql-ktor/build.gradle.kts @@ -4,6 +4,7 @@ plugins { kotlin("plugin.serialization") version "1.5.0" id("org.jetbrains.dokka") version "1.4.32" signing + id("maven-publish") } val caffeine_version: String by project diff --git a/kgraphql/build.gradle.kts b/kgraphql/build.gradle.kts index f8b6bc89..29b00852 100644 --- a/kgraphql/build.gradle.kts +++ b/kgraphql/build.gradle.kts @@ -3,6 +3,7 @@ plugins { base kotlin("jvm") version "1.5.10" id("org.jetbrains.dokka") version "1.4.32" + id("maven-publish") signing } From 166ec7f8dab6974ed446df173d2d460f4a7dbe63 Mon Sep 17 00:00:00 2001 From: magr Date: Thu, 14 Oct 2021 13:55:18 +0200 Subject: [PATCH 05/11] add extensions-Field to GraphQLError.kt --- .../src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt | 7 +++++++ .../src/main/kotlin/com/apurebase/kgraphql/GraphQLError.kt | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt b/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt index 23ac8325..733f5422 100644 --- a/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt +++ b/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt @@ -105,6 +105,13 @@ class GraphQL(val schema: Schema) { put("path", buildJsonArray { // TODO: Build this path. https://spec.graphql.org/June2018/#example-90475 }) + extensions?.let { + put("extensions", buildJsonObject { + it.forEach { (key, value) -> + put(key, value) + } + }) + } } }) }.toString() diff --git a/kgraphql/src/main/kotlin/com/apurebase/kgraphql/GraphQLError.kt b/kgraphql/src/main/kotlin/com/apurebase/kgraphql/GraphQLError.kt index 45723413..ad24624d 100644 --- a/kgraphql/src/main/kotlin/com/apurebase/kgraphql/GraphQLError.kt +++ b/kgraphql/src/main/kotlin/com/apurebase/kgraphql/GraphQLError.kt @@ -33,7 +33,12 @@ open class GraphQLError( /** * The original error thrown from a field resolver during execution. */ - val originalError: Throwable? = null + val originalError: Throwable? = null, + + /** + * Additional information to the error + */ + val extensions: Map? = null ) : Exception(message) { constructor(message: String, node: ASTNode?) : this(message, nodes = node?.let(::listOf)) From 52b44cf0f871485194812a360f65eeb74f9c00d1 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 17 Jul 2022 15:04:37 +0200 Subject: [PATCH 06/11] add unit test for error serializer --- .../com/apurebase/kgraphql/KtorFeature.kt | 2 +- .../com/apurebase/kgraphql/KtorFeatureTest.kt | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt b/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt index 733f5422..c0a67fa0 100644 --- a/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt +++ b/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt @@ -90,7 +90,7 @@ class GraphQL(val schema: Schema) { return GraphQL(schema) } - private fun GraphQLError.serialize(): String = buildJsonObject { + internal fun GraphQLError.serialize(): String = buildJsonObject { put("errors", buildJsonArray { addJsonObject { put("message", message) diff --git a/kgraphql-ktor/src/test/kotlin/com/apurebase/kgraphql/KtorFeatureTest.kt b/kgraphql-ktor/src/test/kotlin/com/apurebase/kgraphql/KtorFeatureTest.kt index 6f4ac8d4..ee327d2b 100644 --- a/kgraphql-ktor/src/test/kotlin/com/apurebase/kgraphql/KtorFeatureTest.kt +++ b/kgraphql-ktor/src/test/kotlin/com/apurebase/kgraphql/KtorFeatureTest.kt @@ -1,5 +1,6 @@ package com.apurebase.kgraphql +import com.apurebase.kgraphql.GraphQL.Feature.serialize import io.ktor.application.* import io.ktor.auth.* import kotlinx.serialization.json.* @@ -110,4 +111,30 @@ class KtorFeatureTest : KtorTest() { } } shouldBeEqualTo "{\"data\":{\"test\":\"success: InputTwo(one=InputOne(enum=M1, id=M1), quantity=3434, tokens=[23, 34, 21, 434])\"}}" } + + @Test + fun `Error serializer test`() { + val graphqlError = GraphQLError( + message = "test", + extensions = mapOf( + "code" to "BAD_USER_INPUT" + ) + ) + + val expectedJson = buildJsonObject { + put("errors", buildJsonArray { + addJsonObject { + put("message", "test") + put("locations", buildJsonArray {}) + put("path", buildJsonArray {}) + put("extensions", buildJsonObject { + put("code", "BAD_USER_INPUT") + }) + } + }) + }.toString() + + graphqlError.serialize() shouldBeEqualTo expectedJson + } + } From 2cd7f963cba465a2461feec7f7731b76317ae5bc Mon Sep 17 00:00:00 2001 From: magr Date: Wed, 29 Sep 2021 10:13:21 +0200 Subject: [PATCH 07/11] unique key for feature --- .../src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt b/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt index bc7d5d08..10a8a279 100644 --- a/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt +++ b/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt @@ -13,6 +13,7 @@ import java.nio.charset.Charset import kotlinx.coroutines.coroutineScope import kotlinx.serialization.json.* import kotlinx.serialization.json.Json.Default.decodeFromString +import java.util.* class GraphQL(val schema: Schema) { @@ -42,9 +43,8 @@ class GraphQL(val schema: Schema) { } - companion object Feature: ApplicationFeature { - override val key = AttributeKey("KGraphQL") + override val key = AttributeKey("KGraphQL-" + UUID.randomUUID()) override fun install(pipeline: Application, configure: Configuration.() -> Unit): GraphQL { val config = Configuration().apply(configure) From 5ea9acfa4e599dc5603f605a5075f21840a7bda0 Mon Sep 17 00:00:00 2001 From: magr Date: Wed, 29 Sep 2021 10:20:55 +0200 Subject: [PATCH 08/11] singing --- build.gradle.kts | 28 ----------------- kgraphql-example/build.gradle.kts | 48 ----------------------------- kgraphql-ktor/build.gradle.kts | 48 ----------------------------- kgraphql/build.gradle.kts | 50 +------------------------------ 4 files changed, 1 insertion(+), 173 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 965f79b6..4abdb4f8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,14 +1,9 @@ -import de.marcphilipp.gradle.nexus.NexusPublishPlugin import java.time.Duration val version: String by project -val sonatypeUsername: String? = System.getenv("sonatypeUsername") -val sonatypePassword: String? = System.getenv("sonatypePassword") plugins { id("com.github.ben-manes.versions") version "0.39.0" - id("io.codearte.nexus-staging") version "0.30.0" - id("de.marcphilipp.nexus-publish") version "0.4.0" jacoco } @@ -21,33 +16,10 @@ allprojects { subprojects { group = "com.apurebase" version = version - - apply() - - nexusPublishing { - repositories { - sonatype() - } - clientTimeout.set(Duration.parse("PT10M")) // 10 minutes - } -} - -nexusStaging { - packageGroup = "com.apurebase" - username = sonatypeUsername - password = sonatypePassword - numberOfRetries = 360 // 1 hour if 10 seconds delay - delayBetweenRetriesInMillis = 10000 // 10 seconds } tasks { wrapper { distributionType = Wrapper.DistributionType.ALL } - closeRepository { - mustRunAfter(subprojects.map { it.tasks.getByName("publishToSonatype") }.toTypedArray()) - } - closeAndReleaseRepository { - mustRunAfter(subprojects.map { it.tasks.getByName("publishToSonatype") }.toTypedArray()) - } } diff --git a/kgraphql-example/build.gradle.kts b/kgraphql-example/build.gradle.kts index 441cfeee..1e98f89b 100644 --- a/kgraphql-example/build.gradle.kts +++ b/kgraphql-example/build.gradle.kts @@ -62,51 +62,3 @@ val dokkaJar by tasks.creating(Jar::class) { classifier = "javadoc" from(tasks.dokkaHtml) } - -publishing { - publications { - create("maven") { - artifactId = project.name - from(components["java"]) - artifact(sourcesJar) - artifact(dokkaJar) - pom { - name.set("KGraphQL") - description.set("KGraphQL is a Kotlin implementation of GraphQL. It provides a rich DSL to set up the GraphQL schema.") - url.set("https://kgraphql.io/") - organization { - name.set("aPureBase") - url.set("http://apurebase.com/") - } - licenses { - license { - name.set("MIT License") - url.set("https://github.com/aPureBase/KGraphQL/blob/main/LICENSE.md") - } - } - developers { - developer { - id.set("jeggy") - name.set("Jógvan Olsen") - email.set("jol@apurebase.com") - } - } - scm { - connection.set("scm:git:https://github.com/aPureBase/KGraphQL.git") - developerConnection.set("scm:git:https://github.com/aPureBase/KGraphQL.git") - url.set("https://github.com/aPureBase/KGraphQL/") - tag.set("HEAD") - } - } - } - } -} - -signing { - isRequired = isReleaseVersion - useInMemoryPgpKeys( - System.getenv("ORG_GRADLE_PROJECT_signingKey"), - System.getenv("ORG_GRADLE_PROJECT_signingPassword") - ) - sign(publishing.publications["maven"]) -} diff --git a/kgraphql-ktor/build.gradle.kts b/kgraphql-ktor/build.gradle.kts index 5b15a615..0e3b1ee0 100644 --- a/kgraphql-ktor/build.gradle.kts +++ b/kgraphql-ktor/build.gradle.kts @@ -66,51 +66,3 @@ val dokkaJar by tasks.creating(Jar::class) { classifier = "javadoc" from(tasks.dokkaHtml) } - -publishing { - publications { - create("maven") { - artifactId = project.name - from(components["java"]) - artifact(sourcesJar) - artifact(dokkaJar) - pom { - name.set("KGraphQL") - description.set("KGraphQL is a Kotlin implementation of GraphQL. It provides a rich DSL to set up the GraphQL schema.") - url.set("https://kgraphql.io/") - organization { - name.set("aPureBase") - url.set("http://apurebase.com/") - } - licenses { - license { - name.set("MIT License") - url.set("https://github.com/aPureBase/KGraphQL/blob/main/LICENSE.md") - } - } - developers { - developer { - id.set("jeggy") - name.set("Jógvan Olsen") - email.set("jol@apurebase.com") - } - } - scm { - connection.set("scm:git:https://github.com/aPureBase/KGraphQL.git") - developerConnection.set("scm:git:https://github.com/aPureBase/KGraphQL.git") - url.set("https://github.com/aPureBase/KGraphQL/") - tag.set("HEAD") - } - } - } - } -} - -signing { - isRequired = isReleaseVersion - useInMemoryPgpKeys( - System.getenv("ORG_GRADLE_PROJECT_signingKey"), - System.getenv("ORG_GRADLE_PROJECT_signingPassword") - ) - sign(publishing.publications["maven"]) -} diff --git a/kgraphql/build.gradle.kts b/kgraphql/build.gradle.kts index e420407d..f8b6bc89 100644 --- a/kgraphql/build.gradle.kts +++ b/kgraphql/build.gradle.kts @@ -74,52 +74,4 @@ val dokkaJar by tasks.creating(Jar::class) { group = JavaBasePlugin.DOCUMENTATION_GROUP classifier = "javadoc" from(tasks.dokkaHtml) -} - -publishing { - publications { - create("maven") { - artifactId = project.name - from(components["java"]) - artifact(sourcesJar) - artifact(dokkaJar) - pom { - name.set("KGraphQL") - description.set("KGraphQL is a Kotlin implementation of GraphQL. It provides a rich DSL to set up the GraphQL schema.") - url.set("https://kgraphql.io/") - organization { - name.set("aPureBase") - url.set("http://apurebase.com/") - } - licenses { - license { - name.set("MIT License") - url.set("https://github.com/aPureBase/KGraphQL/blob/main/LICENSE.md") - } - } - developers { - developer { - id.set("jeggy") - name.set("Jógvan Olsen") - email.set("jol@apurebase.com") - } - } - scm { - connection.set("scm:git:https://github.com/aPureBase/KGraphQL.git") - developerConnection.set("scm:git:https://github.com/aPureBase/KGraphQL.git") - url.set("https://github.com/aPureBase/KGraphQL/") - tag.set("HEAD") - } - } - } - } -} - -signing { - isRequired = isReleaseVersion - useInMemoryPgpKeys( - System.getenv("ORG_GRADLE_PROJECT_signingKey"), - System.getenv("ORG_GRADLE_PROJECT_signingPassword") - ) - sign(publishing.publications["maven"]) -} +} \ No newline at end of file From f2afeeee9c481e6d5106c531cb9a41523a3d4d91 Mon Sep 17 00:00:00 2001 From: magr Date: Wed, 29 Sep 2021 10:31:31 +0200 Subject: [PATCH 09/11] add maven plugin --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 4abdb4f8..d23139a7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,9 @@ -import java.time.Duration val version: String by project plugins { id("com.github.ben-manes.versions") version "0.39.0" + id("maven") jacoco } From 2e5eebf4ae401309d081ffba49cb116a14ce47bb Mon Sep 17 00:00:00 2001 From: magr Date: Wed, 29 Sep 2021 10:36:51 +0200 Subject: [PATCH 10/11] more maven-publish plugin --- build.gradle.kts | 2 +- kgraphql-ktor/build.gradle.kts | 1 + kgraphql/build.gradle.kts | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index d23139a7..f52cb641 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ val version: String by project plugins { id("com.github.ben-manes.versions") version "0.39.0" - id("maven") + id("maven-publish") jacoco } diff --git a/kgraphql-ktor/build.gradle.kts b/kgraphql-ktor/build.gradle.kts index 0e3b1ee0..11999547 100644 --- a/kgraphql-ktor/build.gradle.kts +++ b/kgraphql-ktor/build.gradle.kts @@ -4,6 +4,7 @@ plugins { kotlin("plugin.serialization") version "1.5.0" id("org.jetbrains.dokka") version "1.4.32" signing + id("maven-publish") } val caffeine_version: String by project diff --git a/kgraphql/build.gradle.kts b/kgraphql/build.gradle.kts index f8b6bc89..29b00852 100644 --- a/kgraphql/build.gradle.kts +++ b/kgraphql/build.gradle.kts @@ -3,6 +3,7 @@ plugins { base kotlin("jvm") version "1.5.10" id("org.jetbrains.dokka") version "1.4.32" + id("maven-publish") signing } From e13ea70522a0d31658c8e702654ab8cefcee44da Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 17 Jul 2022 15:17:41 +0200 Subject: [PATCH 11/11] manually resolve conflict --- .../main/kotlin/com/apurebase/kgraphql/KtorFeature.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt b/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt index 10a8a279..2ee4965d 100644 --- a/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt +++ b/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt @@ -103,7 +103,7 @@ class GraphQL(val schema: Schema) { return receiveStream().bufferedReader(charset = suitableCharset).readText() } - private fun GraphQLError.serialize(): String = buildJsonObject { + internal fun GraphQLError.serialize(): String = buildJsonObject { put("errors", buildJsonArray { addJsonObject { put("message", message) @@ -118,6 +118,13 @@ class GraphQL(val schema: Schema) { put("path", buildJsonArray { // TODO: Build this path. https://spec.graphql.org/June2018/#example-90475 }) + extensions?.let { + put("extensions", buildJsonObject { + it.forEach { (key, value) -> + put(key, value) + } + }) + } } }) }.toString()