apollographql / apollographql/federation
Add subgraph names as structured data to composition errors
- Dominant language
- TypeScript
- Stars
- 725
- Forks
- 276
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 1
Description
The current shape of a composition error returned from federation is a `GraphQLError` [with a message, locations (soon), and an extensions field with the error code inside](https://github.com/apollographql/federation/blob/40ad8f545a45a82ad6d34b57dd92971ac223f360/federation-js/src/composition/utils.ts#L211). The only way to know if an error is associated with a certain subgraph on composition is to parse the service name out of the error message.
example error message with subgraph names:
```
The HelloIAmAnEnum enum does not have identical values in all services. Groups of services with identical values are: [serviceA], [serviceB].
```
I propose we add `subgraphNames` or `serviceNames` as a field on `extensions` of the composition errors we return that can be associated with one or more subgraphs. If locations & subgraph names are added to composition errors, we will have reasonable information to allow folks to look at the data in a composition error, and know where the look to go about fixing that error.
If this sounds good, I am happy to make the PR! :)
Contributor guide
Assessment
This issue has not been assessed yet.