diff --git a/build.gradle.kts b/build.gradle.kts index 467498c..217572f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,13 +6,13 @@ repositories { plugins { kotlin("jvm") version "2.4.0" - id("com.expediagroup.graphql") version "9.2.0" + id("com.expediagroup.graphql") version "10.0.0" } dependencies { - implementation("com.expediagroup", "graphql-kotlin-schema-generator", "9.2.0") - implementation("com.expediagroup", "graphql-kotlin-server", "9.2.0") - implementation("com.expediagroup", "graphql-kotlin-federation", "9.2.0") + implementation("com.expediagroup", "graphql-kotlin-schema-generator", "10.0.0") + implementation("com.expediagroup", "graphql-kotlin-server", "10.0.0") + implementation("com.expediagroup", "graphql-kotlin-federation", "10.0.0") } sourceSets { diff --git a/src/definitions/field.ts b/src/definitions/field.ts index 142dec5..39e2779 100644 --- a/src/definitions/field.ts +++ b/src/definitions/field.ts @@ -191,7 +191,7 @@ function buildField( let typeDefinition = `${typeMetadata.typeName}${typeMetadata.isNullable ? "?" : ""}`; let defaultDefinition = `${typeMetadata.typeName}${defaultDefinitionValue}`; if (isDataFetcherResult) { - typeDefinition = `graphql.execution.DataFetcherResult<${typeDefinition}>`; + typeDefinition = `graphql.execution.DataFetcherResult<${typeMetadata.typeName}>`; defaultDefinition = `${typeDefinition} = ${defaultImplementation}`; } const completableFutureDefinition = `java.util.concurrent.CompletableFuture<${typeDefinition}> = ${defaultImplementation}`; @@ -364,13 +364,13 @@ function getNullableFieldDefaultValue( const isDataFetcherResult = typeInResolverInterfacesConfig.dataFetcherResult; if (isCompletableFuture && isDataFetcherResult) { - return `java.util.concurrent.CompletableFuture.completedFuture(graphql.execution.DataFetcherResult.newResult<${typeMetadata.typeName}?>().data(null).build())`; + return `java.util.concurrent.CompletableFuture.completedFuture(graphql.execution.DataFetcherResult.newResult<${typeMetadata.typeName}>().data(null).build())`; } if (isCompletableFuture) { return `java.util.concurrent.CompletableFuture.completedFuture(null)`; } if (isDataFetcherResult) { - return `graphql.execution.DataFetcherResult.newResult<${typeMetadata.typeName}?>().data(null).build()`; + return `graphql.execution.DataFetcherResult.newResult<${typeMetadata.typeName}>().data(null).build()`; } return "null"; } diff --git a/test/unit/should_honor_dataFetcherResult_config_completable_future/expected.kt b/test/unit/should_honor_dataFetcherResult_config_completable_future/expected.kt index 4cfd86a..baf6792 100644 --- a/test/unit/should_honor_dataFetcherResult_config_completable_future/expected.kt +++ b/test/unit/should_honor_dataFetcherResult_config_completable_future/expected.kt @@ -4,14 +4,14 @@ 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> = java.util.concurrent.CompletableFuture.completedFuture(graphql.execution.DataFetcherResult.newResult().data(null).build()) + open fun stringField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture> = java.util.concurrent.CompletableFuture.completedFuture(graphql.execution.DataFetcherResult.newResult().data(null).build()) open fun stringField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture> = throw NotImplementedError("DataFetcherResultCompletableFutureType.stringField2 must be implemented.") - open fun booleanField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture> = java.util.concurrent.CompletableFuture.completedFuture(graphql.execution.DataFetcherResult.newResult().data(null).build()) + open fun booleanField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture> = java.util.concurrent.CompletableFuture.completedFuture(graphql.execution.DataFetcherResult.newResult().data(null).build()) open fun booleanField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture> = throw NotImplementedError("DataFetcherResultCompletableFutureType.booleanField2 must be implemented.") - open fun integerField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture> = java.util.concurrent.CompletableFuture.completedFuture(graphql.execution.DataFetcherResult.newResult().data(null).build()) + open fun integerField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture> = java.util.concurrent.CompletableFuture.completedFuture(graphql.execution.DataFetcherResult.newResult().data(null).build()) open fun integerField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture> = throw NotImplementedError("DataFetcherResultCompletableFutureType.integerField2 must be implemented.") open fun listField(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture>> = throw NotImplementedError("DataFetcherResultCompletableFutureType.listField must be implemented.") open fun listField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture>> = throw NotImplementedError("DataFetcherResultCompletableFutureType.listField2 must be implemented.") - open fun listField3(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture?>> = java.util.concurrent.CompletableFuture.completedFuture(graphql.execution.DataFetcherResult.newResult?>().data(null).build()) - open fun listField4(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture?>> = java.util.concurrent.CompletableFuture.completedFuture(graphql.execution.DataFetcherResult.newResult?>().data(null).build()) + open fun listField3(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture>> = java.util.concurrent.CompletableFuture.completedFuture(graphql.execution.DataFetcherResult.newResult>().data(null).build()) + open fun listField4(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): java.util.concurrent.CompletableFuture>> = java.util.concurrent.CompletableFuture.completedFuture(graphql.execution.DataFetcherResult.newResult>().data(null).build()) } diff --git a/test/unit/should_honor_dataFetcherResult_config_suspend/expected.kt b/test/unit/should_honor_dataFetcherResult_config_suspend/expected.kt index 5031ca7..a3e4658 100644 --- a/test/unit/should_honor_dataFetcherResult_config_suspend/expected.kt +++ b/test/unit/should_honor_dataFetcherResult_config_suspend/expected.kt @@ -4,14 +4,14 @@ 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 = graphql.execution.DataFetcherResult.newResult().data(null).build() + open suspend fun stringField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult = graphql.execution.DataFetcherResult.newResult().data(null).build() open suspend fun stringField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult = throw NotImplementedError("DataFetcherResultSuspendType.stringField2 must be implemented.") - open suspend fun booleanField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult = graphql.execution.DataFetcherResult.newResult().data(null).build() + open suspend fun booleanField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult = graphql.execution.DataFetcherResult.newResult().data(null).build() open suspend fun booleanField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult = throw NotImplementedError("DataFetcherResultSuspendType.booleanField2 must be implemented.") - open suspend fun integerField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult = graphql.execution.DataFetcherResult.newResult().data(null).build() + open suspend fun integerField1(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult = graphql.execution.DataFetcherResult.newResult().data(null).build() open suspend fun integerField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult = throw NotImplementedError("DataFetcherResultSuspendType.integerField2 must be implemented.") open suspend fun listField(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult> = throw NotImplementedError("DataFetcherResultSuspendType.listField must be implemented.") open suspend fun listField2(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult> = throw NotImplementedError("DataFetcherResultSuspendType.listField2 must be implemented.") - open suspend fun listField3(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult?> = graphql.execution.DataFetcherResult.newResult?>().data(null).build() - open suspend fun listField4(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult?> = graphql.execution.DataFetcherResult.newResult?>().data(null).build() + open suspend fun listField3(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult> = graphql.execution.DataFetcherResult.newResult>().data(null).build() + open suspend fun listField4(dataFetchingEnvironment: graphql.schema.DataFetchingEnvironment): graphql.execution.DataFetcherResult> = graphql.execution.DataFetcherResult.newResult>().data(null).build() }