-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add dataFetcherResult option to return both errors and partial …
…data (#126)
- Loading branch information
1 parent
f46b5da
commit 5df1e00
Showing
9 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
test/unit/should_honor_dataFetcherResult_config_completable_future/codegen.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { GraphQLKotlinCodegenConfig } from "../../../src/plugin"; | ||
|
||
export default { | ||
resolverInterfaces: [ | ||
{ | ||
typeName: "DataFetcherResultCompletableFutureType", | ||
classMethods: "COMPLETABLE_FUTURE", | ||
dataFetcherResult: true, | ||
}, | ||
], | ||
} satisfies GraphQLKotlinCodegenConfig; |
17 changes: 17 additions & 0 deletions
17
test/unit/should_honor_dataFetcherResult_config_completable_future/expected.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.kotlin.generated | ||
|
||
import com.expediagroup.graphql.generator.annotations.* | ||
|
||
@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.OBJECT]) | ||
open class DataFetcherResultCompletableFutureType { | ||
open fun stringField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture<graphql.execution.DataFetcherResult<String?>> = throw NotImplementedError("DataFetcherResultCompletableFutureType.stringField1 must be implemented.") | ||
open fun stringField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture<graphql.execution.DataFetcherResult<String>> = throw NotImplementedError("DataFetcherResultCompletableFutureType.stringField2 must be implemented.") | ||
open fun booleanField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture<graphql.execution.DataFetcherResult<Boolean?>> = throw NotImplementedError("DataFetcherResultCompletableFutureType.booleanField1 must be implemented.") | ||
open fun booleanField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture<graphql.execution.DataFetcherResult<Boolean>> = throw NotImplementedError("DataFetcherResultCompletableFutureType.booleanField2 must be implemented.") | ||
open fun integerField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture<graphql.execution.DataFetcherResult<Int?>> = throw NotImplementedError("DataFetcherResultCompletableFutureType.integerField1 must be implemented.") | ||
open fun integerField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture<graphql.execution.DataFetcherResult<Int>> = throw NotImplementedError("DataFetcherResultCompletableFutureType.integerField2 must be implemented.") | ||
open fun listField(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture<graphql.execution.DataFetcherResult<List<String>>> = throw NotImplementedError("DataFetcherResultCompletableFutureType.listField must be implemented.") | ||
open fun listField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture<graphql.execution.DataFetcherResult<List<String?>>> = throw NotImplementedError("DataFetcherResultCompletableFutureType.listField2 must be implemented.") | ||
open fun listField3(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture<graphql.execution.DataFetcherResult<List<String>?>> = throw NotImplementedError("DataFetcherResultCompletableFutureType.listField3 must be implemented.") | ||
open fun listField4(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture<graphql.execution.DataFetcherResult<List<String?>?>> = throw NotImplementedError("DataFetcherResultCompletableFutureType.listField4 must be implemented.") | ||
} |
12 changes: 12 additions & 0 deletions
12
test/unit/should_honor_dataFetcherResult_config_completable_future/schema.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
type DataFetcherResultCompletableFutureType { | ||
stringField1: String | ||
stringField2: String! | ||
booleanField1: Boolean | ||
booleanField2: Boolean! | ||
integerField1: Int | ||
integerField2: Int! | ||
listField: [String!]! | ||
listField2: [String]! | ||
listField3: [String!] | ||
listField4: [String] | ||
} |
11 changes: 11 additions & 0 deletions
11
test/unit/should_honor_dataFetcherResult_config_suspend/codegen.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { GraphQLKotlinCodegenConfig } from "../../../src/plugin"; | ||
|
||
export default { | ||
resolverInterfaces: [ | ||
{ | ||
typeName: "DataFetcherResultSuspendType", | ||
classMethods: "SUSPEND", | ||
dataFetcherResult: true, | ||
}, | ||
], | ||
} satisfies GraphQLKotlinCodegenConfig; |
17 changes: 17 additions & 0 deletions
17
test/unit/should_honor_dataFetcherResult_config_suspend/expected.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.kotlin.generated | ||
|
||
import com.expediagroup.graphql.generator.annotations.* | ||
|
||
@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.OBJECT]) | ||
open class DataFetcherResultSuspendType { | ||
open suspend fun stringField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult<String?> = throw NotImplementedError("DataFetcherResultSuspendType.stringField1 must be implemented.") | ||
open suspend fun stringField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult<String> = throw NotImplementedError("DataFetcherResultSuspendType.stringField2 must be implemented.") | ||
open suspend fun booleanField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult<Boolean?> = throw NotImplementedError("DataFetcherResultSuspendType.booleanField1 must be implemented.") | ||
open suspend fun booleanField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult<Boolean> = throw NotImplementedError("DataFetcherResultSuspendType.booleanField2 must be implemented.") | ||
open suspend fun integerField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult<Int?> = throw NotImplementedError("DataFetcherResultSuspendType.integerField1 must be implemented.") | ||
open suspend fun integerField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult<Int> = throw NotImplementedError("DataFetcherResultSuspendType.integerField2 must be implemented.") | ||
open suspend fun listField(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult<List<String>> = throw NotImplementedError("DataFetcherResultSuspendType.listField must be implemented.") | ||
open suspend fun listField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult<List<String?>> = throw NotImplementedError("DataFetcherResultSuspendType.listField2 must be implemented.") | ||
open suspend fun listField3(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult<List<String>?> = throw NotImplementedError("DataFetcherResultSuspendType.listField3 must be implemented.") | ||
open suspend fun listField4(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult<List<String?>?> = throw NotImplementedError("DataFetcherResultSuspendType.listField4 must be implemented.") | ||
} |
12 changes: 12 additions & 0 deletions
12
test/unit/should_honor_dataFetcherResult_config_suspend/schema.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
type DataFetcherResultSuspendType { | ||
stringField1: String | ||
stringField2: String! | ||
booleanField1: Boolean | ||
booleanField2: Boolean! | ||
integerField1: Int | ||
integerField2: Int! | ||
listField: [String!]! | ||
listField2: [String]! | ||
listField3: [String!] | ||
listField4: [String] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters