Skip to content

Commit c2e10ab

Browse files
committed
Add data fetcher references in schema provider for @DgsEntityFetcher methods
1 parent d3ef3a1 commit c2e10ab

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

graphql-dgs/src/main/kotlin/com/netflix/graphql/dgs/internal/DgsSchemaProvider.kt

+9-2
Original file line numberDiff line numberDiff line change
@@ -611,12 +611,19 @@ class DgsSchemaProvider
611611
.forEach { method ->
612612
val dgsEntityFetcherAnnotation = method.getAnnotation(DgsEntityFetcher::class.java)
613613

614+
val entityFetcherTypeName = dgsEntityFetcherAnnotation.name
615+
val coordinateName = "_entities.$entityFetcherTypeName"
616+
617+
val mergedAnnotations =
618+
MergedAnnotations
619+
.from(method, MergedAnnotations.SearchStrategy.TYPE_HIERARCHY)
620+
dataFetcherInfo.dataFetchers +=
621+
DataFetcherReference(dgsComponent.instance, method, mergedAnnotations, "Query", coordinateName)
622+
614623
val enableInstrumentation =
615624
method.getAnnotation(DgsEnableDataFetcherInstrumentation::class.java)?.value
616625
?: false
617-
val entityFetcherTypeName = dgsEntityFetcherAnnotation.name
618626
if (enableInstrumentation) {
619-
val coordinateName = "__entities.$entityFetcherTypeName"
620627
dataFetcherInfo.tracingEnabled += coordinateName
621628
dataFetcherInfo.metricsEnabled += coordinateName
622629
}

0 commit comments

Comments
 (0)