apollographql / apollographql/federation
Make the merging rule for enum that are both input and output more flexible
- Dominant language
- TypeScript
- Stars
- 725
- Forks
- 276
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 1
Description
The context/background for this is explained in details in [this comment](https://github.com/apollographql/federation/issues/2005#issuecomment-1192353960), but the short version is that if an enum type is used as _both_ an input and output type in subgraphs, then we currently require that the definition is the same in every subgraphs (excluding `@inaccessible` fields). As explained in the linked comment, there is reason for this in general, but we can still make that rule a bit more flexible (if more complex) by considering more precisely the definition in each subgraphs. More precisely, we need the definitions to be equal in all the subgraph in which the enum is an input type, but if there is subgraph in which the enum is _only_ an output type, then it is fine if that subgraph has only a subset of the values (can't have a superset, but subset is ok).
Essentially, this will give a bit more flexibility for the case where an enum is used both has input and output, but is only used as input in a small number of subgraph (say, just one). Because in that case, as long as the subgraph where the enum is used as input gets new enum values first, then the other subgraph can be updated later without needing `@inacessible`.
Contributor guide
Research direction
Start with the linked context in issue 2005, then locate the enum-merging validation that handles enums used as both input and output. Add coverage for equal definitions across input subgraphs and subset definitions in output-only subgraphs; done means supersets remain rejected and the existing @inaccessible behavior is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100