Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data fetcher references in schema provider for @DgsEntityFetcher methods #2109

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -611,12 +611,19 @@ class DgsSchemaProvider
.forEach { method ->
val dgsEntityFetcherAnnotation = method.getAnnotation(DgsEntityFetcher::class.java)

val entityFetcherTypeName = dgsEntityFetcherAnnotation.name
val coordinateName = "_entities.$entityFetcherTypeName"

val mergedAnnotations =
MergedAnnotations
.from(method, MergedAnnotations.SearchStrategy.TYPE_HIERARCHY)
dataFetcherInfo.dataFetchers +=
DataFetcherReference(dgsComponent.instance, method, mergedAnnotations, "Query", coordinateName)

val enableInstrumentation =
method.getAnnotation(DgsEnableDataFetcherInstrumentation::class.java)?.value
?: false
val entityFetcherTypeName = dgsEntityFetcherAnnotation.name
if (enableInstrumentation) {
val coordinateName = "__entities.$entityFetcherTypeName"
dataFetcherInfo.tracingEnabled += coordinateName
dataFetcherInfo.metricsEnabled += coordinateName
}
Expand Down
Loading