Skip to content

Document use of DataFetcherResult for injecting values in local context #1167

Closed
@bclozel

Description

@bclozel

See #1142 for background

Right now Annotated controllers support many method arguments, including:

  • @ContextValue, for access to an attribute from the main GraphQLContext in DataFetchingEnvironment.
  • @LocalContextValue, for access to an attribute from the local GraphQLContext in DataFetchingEnvironment.
  • GraphQLContext, for access to the context from the DataFetchingEnvironment.

Controller methods can only contribute a new local context by returning a DataFetcherResult<ReturnType>. Spring MVC does support java.util.Map, org.springframework.ui.Model, org.springframework.ui.ModelMap as mutable maps to be used when rendering a view. Injecting a new, mutable GraphQLContext local context would be quite similar to existing MVC support but might be confusing given the extensive context support we already have.

As part of this issue, we should first document the DataFetcherResult route and then consider whether we want to improve support.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions