Description
What happened?
I have a number of graphql files that hold shared type definitions from multiple backends. Not every backend uses every type, but it's convenient to be able to deduplicate them in cases where they are shared.
Unfortunately, currently, this results in every backend being forced to generate resolvers for every type.
What did you expect?
I expected that unreachable types don't need to be implemented and don't affect the output of gqlgen.
Minimal graphql.schema and models to reproduce
https://github.com/vikstrous/unreachable-repro
The "expected" directory was produced with #1238
Expected: https://github.com/vikstrous/unreachable-repro/blob/master/expected/userservice/generated.go#L43
Actual: https://github.com/vikstrous/unreachable-repro/blob/master/actual/userservice/generated.go#L43
versions
gqlgen version
: mastergo version
: 1.14.4- dep or go modules: go modules
Other
Note that this is not just a slight annoyance. In order to split up our graphql schema and move towards federation, we need to be able to take chunks out of the main common schema one at a time. With multiple different services re-implementing the same graphql resolvers, we would have to duplicate our schema 5 times as the first step towards federation. It's very hard to do this at scale and having this feature in gqlgen would really simplify our transition.