Skip to content

Commit 0c61053

Browse files
committed
feat!: support dataProperty with ParallelRequestExecutor
Adds proper handling for `dataProperties` to `ParallelRequestExecutor` and gets rid of `DataLoaderPreparedRequestExecutor`, along with the option to configure the request executor in `SchemaConfiguration` and related `DataLoaderPreparedRequestExecutor`-specific options. This also consolidates some tests that were hardcoded to use one of the request executors, and therefore missed the other, and extends coverage for dataProperties a bit. Further, this reduces visibility of some functions to `internal` to reduce namespace pollution. Resolves #58 Resolves #268 BREAKING CHANGE: The option to configure request executors has been removed, and execution will now always use the `ParallelRequestExecutor`. BREAKING CHANGE: The option to configure a timeout has been removed, as it was only respected by `DataLoaderPreparedRequestExecutor`. BREAKING CHANGE: The possibility to pass `ExecutionOptions` to schema execution has been removed, as it was only respected by `DataLoaderPreparedRequestExecutor`. BREAKING CHANGE: The `DataLoaderPreparedRequestExecutor`, `Executor`, and `ExecutionOptions` classes have been removed.
1 parent 1cb755d commit 0c61053

36 files changed

+447
-958
lines changed

docs/content/Reference/Type System/objects-and-interfaces.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -324,22 +324,11 @@ people in the second query. That's what the `dataProperty` will solve for you.
324324

325325
### Setting up
326326

327-
Using DataLoaders requires the `DataLoaderPrepared` executor:
328-
329-
```kotlin
330-
configure {
331-
executor = Executor.DataLoaderPrepared
332-
}
333-
```
334-
335327
=== "Example"
336328
```kotlin
337329
data class Person(val id: Int, val name: String)
338330
val people = (1..5).map { Person(it, "Name-$it") }
339331
...
340-
configure {
341-
executor = Executor.DataLoaderPrepared
342-
}
343332
query("people") {
344333
resolver { -> people }
345334
}
@@ -403,13 +392,3 @@ configure {
403392
}
404393
}
405394
```
406-
407-
### Current known issues
408-
409-
This feature can be used in production but does currently have some issues:
410-
411-
1. The `useDefaultPrettyPrint` doesn't work
412-
1. Order of fields are not guaranteed to match the order that was requested
413-
1. Custom generic type resolvers are not supported
414-
1. Schema stitching is not supported
415-
1. Other than that it should work as expected

docs/content/Reference/configuration.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ KGraphQL schema allows configuration of the following properties:
88
| objectMapper | Schema is using Jackson ObjectMapper from this property | result of `jacksonObjectMapper()` from [jackson-kotlin-module](https://github.com/FasterXML/jackson-module-kotlin) |
99
| acceptSingleValueAsArray | Schema accepts single argument values as singleton list | `true` |
1010
| coroutineDispatcher | Schema is using CoroutineDispatcher from this property | [CommonPool](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/CommonPool.kt) |
11-
| executor | | [Executor.Parallel](https://github.com/aPureBase/KGraphQL/blob/master/kgraphql/src/main/kotlin/com/apurebase/kgraphql/schema/execution/Executor.kt) |
1211
| genericTypeResolver | Schema is using generic type resolver from this property | [GenericTypeResolver.DEFAULT](https://github.com/aPureBase/KGraphQL/blob/master/kgraphql/src/main/kotlin/com/apurebase/kgraphql/schema/execution/GenericTypeResolver.kt) |
1312
| wrapErrors | | `true` |
14-
| timeout | | `null` |
1513
| introspection | Schema allows introspection (also affects SDL). Introspection can be disabled in production to reduce attack surface. | `true` |
1614

1715
=== "Example"

gradle/libs.versions.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serializa
2727
jackson-core-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" }
2828
jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson" }
2929
aedile = { module = "com.sksamuel.aedile:aedile-core", version = "3.0.1" }
30-
deferredJsonBuilder = { module = "com.apurebase:DeferredJsonBuilder", version = "1.0.0" }
3130
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
3231
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
3332
ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" }

kgraphql-ktor-stitched/api/kgraphql-ktor-stitched.api

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public final class com/apurebase/kgraphql/stitched/StitchedKGraphQL {
6060
}
6161

6262
public final class com/apurebase/kgraphql/stitched/schema/configuration/StitchedSchemaConfiguration : com/apurebase/kgraphql/configuration/SchemaConfiguration {
63-
public fun <init> (ZJLcom/fasterxml/jackson/databind/ObjectMapper;ZLkotlinx/coroutines/CoroutineDispatcher;ZLcom/apurebase/kgraphql/schema/execution/Executor;Ljava/lang/Long;ZLcom/apurebase/kgraphql/schema/execution/GenericTypeResolver;Lcom/apurebase/kgraphql/schema/execution/ArgumentTransformer;Lcom/apurebase/kgraphql/stitched/schema/execution/RemoteRequestExecutor;Ljava/lang/String;)V
64-
public synthetic fun <init> (ZJLcom/fasterxml/jackson/databind/ObjectMapper;ZLkotlinx/coroutines/CoroutineDispatcher;ZLcom/apurebase/kgraphql/schema/execution/Executor;Ljava/lang/Long;ZLcom/apurebase/kgraphql/schema/execution/GenericTypeResolver;Lcom/apurebase/kgraphql/schema/execution/ArgumentTransformer;Lcom/apurebase/kgraphql/stitched/schema/execution/RemoteRequestExecutor;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
63+
public fun <init> (ZJLcom/fasterxml/jackson/databind/ObjectMapper;ZLkotlinx/coroutines/CoroutineDispatcher;ZZLcom/apurebase/kgraphql/schema/execution/GenericTypeResolver;Lcom/apurebase/kgraphql/schema/execution/ArgumentTransformer;Lcom/apurebase/kgraphql/stitched/schema/execution/RemoteRequestExecutor;Ljava/lang/String;)V
64+
public synthetic fun <init> (ZJLcom/fasterxml/jackson/databind/ObjectMapper;ZLkotlinx/coroutines/CoroutineDispatcher;ZZLcom/apurebase/kgraphql/schema/execution/GenericTypeResolver;Lcom/apurebase/kgraphql/schema/execution/ArgumentTransformer;Lcom/apurebase/kgraphql/stitched/schema/execution/RemoteRequestExecutor;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
6565
public final fun getLocalUrl ()Ljava/lang/String;
6666
public final fun getRemoteExecutor ()Lcom/apurebase/kgraphql/stitched/schema/execution/RemoteRequestExecutor;
6767
}

kgraphql-ktor-stitched/src/main/kotlin/com/apurebase/kgraphql/stitched/schema/configuration/StitchedSchemaConfiguration.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.apurebase.kgraphql.stitched.schema.configuration
33
import com.apurebase.kgraphql.ExperimentalAPI
44
import com.apurebase.kgraphql.configuration.SchemaConfiguration
55
import com.apurebase.kgraphql.schema.execution.ArgumentTransformer
6-
import com.apurebase.kgraphql.schema.execution.Executor
76
import com.apurebase.kgraphql.schema.execution.GenericTypeResolver
87
import com.apurebase.kgraphql.stitched.schema.execution.RemoteRequestExecutor
98
import com.fasterxml.jackson.databind.ObjectMapper
@@ -20,8 +19,6 @@ class StitchedSchemaConfiguration(
2019
// execution
2120
coroutineDispatcher: CoroutineDispatcher,
2221
wrapErrors: Boolean,
23-
executor: Executor,
24-
timeout: Long?,
2522
// allow schema introspection
2623
introspection: Boolean = true,
2724
genericTypeResolver: GenericTypeResolver,
@@ -35,8 +32,6 @@ class StitchedSchemaConfiguration(
3532
useDefaultPrettyPrinter,
3633
coroutineDispatcher,
3734
wrapErrors,
38-
executor,
39-
timeout,
4035
introspection,
4136
genericTypeResolver,
4237
argumentTransformer

kgraphql-ktor-stitched/src/main/kotlin/com/apurebase/kgraphql/stitched/schema/dsl/StitchedSchemaConfigurationDSL.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ open class StitchedSchemaConfigurationDSL : SchemaConfigurationDSL() {
2424
useDefaultPrettyPrinter = useDefaultPrettyPrinter,
2525
coroutineDispatcher = coroutineDispatcher,
2626
wrapErrors = wrapErrors,
27-
executor = executor,
28-
timeout = timeout,
2927
introspection = introspection,
3028
genericTypeResolver = genericTypeResolver,
3129
argumentTransformer = RemoteArgumentTransformer(),

kgraphql-ktor/src/test/kotlin/com/apurebase/kgraphql/KtorConfigurationTest.kt

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)