apollographql / apollographql/federation
Federation: The query root must be named `Query` in all implementing services
- Dominant language
- TypeScript
- Stars
- 725
- Forks
- 276
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 1
Description
If, for some reason, one of the implementing services does not name the query root `Query`, then the gateway doesn't know about any query operations provided by that service. The gateway (I'm using `0.20.0`) appears to just download the SDL from the service, it really needs to query via introspection to get the name of the query and mutation objects from each service.
In my case, I'm adding support for federation to the Lacinia library (Clojure) which has different default names; it defaults to `QueryRoot` and this caused the problems above.
The workaround is to add queries to a `Query` object, and add `schema { query: Query }` to the SDL document.
And, although I have not tested, this certainly applies to `Mutation` as well.
Contributor guide
Research direction
Start at the gateway path that downloads each service's SDL and compare it with GraphQL introspection handling; inspect how query and mutation root names are derived. Verify completion with a service whose roots are named QueryRoot and MutationRoot, confirming that its query and mutation operations are discovered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100