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

Can not select field from another subgraph on Viewer type returned in mutation payload #7996

Open
tobias-tengler opened this issue Feb 6, 2025 · 0 comments · May be fixed by #8000
Open
Labels
Area: Fusion Issue is related to Hot Chocolate Fusion 🌶️ hot chocolate

Comments

@tobias-tengler
Copy link
Collaborator

tobias-tengler commented Feb 6, 2025

Product

Hot Chocolate

Version

15.0.1

Link to minimal reproduction

b837653

Steps to reproduce

Write a mutation that returns the viewer and selects fields on the viewer that are not available on the subgraph the mutation is on.

mutation {
  doSomething {
    viewer {
      somethingFromAnotherSubgraph
    }
  }
}

What is expected?

Similar to the global object identification specification, the viewer pattern is a well established pattern in the GraphQL world.
To fetch additional fields on the viewer the query planner should check if there is a Query.viewer field on the targeted subgraph and use that to resolve the additional fields on the Viewer type.

What is actually happening?

The query plan generation fails with the error There must be a field resolver definition in this context!.

Relevant log output

Additional context

No response

@tobias-tengler tobias-tengler added the Area: Fusion Issue is related to Hot Chocolate Fusion label Feb 6, 2025
@tobias-tengler tobias-tengler linked a pull request Feb 6, 2025 that will close this issue
@tobias-tengler tobias-tengler changed the title Support viewer field convention Can not select field from another subgraph on Viewer type returned in mutation payload Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Fusion Issue is related to Hot Chocolate Fusion 🌶️ hot chocolate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant