ContextDataFetcherDecorator ignores subscriptions when "subscription" type is renamed #590
Labels
status: backported
An issue that has been backported to maintenance branches
type: enhancement
A general enhancement
Milestone
Hello,
In GraphQL, it is possible to rename the query, mutation and subscription objects in the schema. When doing so, data fetcher that returns
Flux
won't work properly in spring-graphql.Sample schema:
For subscription, this is due to this line in
org.springframework.graphql.execution.ContextDataFetcherDecorator
:To check that, I executed the test provided below, after changing Subscription to MySubscription in
ContextDataFetcherDecorator
: doing this makes the test pass ok.My first attempt to create a unit test generates wrong failures for Query and Mutation, as the
queryFetcher
andmutationFetcher
hard coded theQuery
andMutation
name. So I updated the test below which is ok for query and mutation.I added the test below in the
org.springframework.graphql.execution.ContextDataFetcherDecoratorTests
. This test is basically a copy/paste of thefluxDataFetcher()
andfluxDataFetcherSubscription()
tests:I'll try to find how to solve this issue, and propose a PR.
If you have hint, it would be nice: I don't know how to retrieve the GraphQL schema's data from the
org.springframework.graphql.execution.ContextDataFetcherDecorator.createVisitor(..)
method.Etienne
The text was updated successfully, but these errors were encountered: