You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We have some cases when local context is required for Data fetching, to be able to pass some specific data for child resolvers. In this case, global context from DataFetchingEnvironment is not an option.
As DataFetcherResult is not supported in the current version of the generator, we have to use the following to be able to generate it for a specific field in GraphQl schema:
abstractclassGraphQLCodegenFixesGradleTask : DefaultTask() {
@get:InputFileabstractvalinputFile: RegularFileProperty@TaskActionfunupdateMobileLandingGridDataGraph() {
valfindStr = "java.util.List<MobileLandingBlockGraph>"// Specify the string to findvalreplaceStr = "java.util.List<graphql.execution.DataFetcherResult<MobileLandingBlockGraph>>"// Specify the string to replace withvalfile = inputFile.get().asFilevalcontent = file.readText()
valupdatedContent = content.replace(findStr, replaceStr)
file.writeText(updatedContent)
}
}
tasks.register<GraphQLCodegenFixesGradleTask>("graphQLCodegenFixes") {
dependsOn("graphqlCodegen")
inputFile.set(file("$buildDir/generated/com/scentbird/web/graphql/model/MobileLandingGridDataGraph.java"))
}
Describe the solution you'd like
The solution I'm proposing is the following:
Add a new property for a plugin: fieldsWithDataFetcherResult = setOf("@dataFetcherResult")
This property will be used to mark fields that require DataFetcherResult generation. For example:
Is your feature request related to a problem? Please describe.
We have some cases when local context is required for Data fetching, to be able to pass some specific data for child resolvers. In this case, global context from DataFetchingEnvironment is not an option.
An example of using a local context:
As DataFetcherResult is not supported in the current version of the generator, we have to use the following to be able to generate it for a specific field in GraphQl schema:
Describe the solution you'd like
The solution I'm proposing is the following:
fieldsWithDataFetcherResult = setOf("@dataFetcherResult")
This property will be used to mark fields that require DataFetcherResult generation. For example:
The text was updated successfully, but these errors were encountered: