Federated Entity type removed from executable schema
Background & Description
First of all, thank you all for the great lib! It is great to see such a mature Schema First library for GraphQL in Java, I'm really enjoying working with it.
I'm trying to use graphql-java-tools with federation-jvm and overall it works great.
However, I'm facing one issue where we have a service which defines its own query, but also extends one entity to add fields to it. Like the schema here.
The root of the issue is that graphql-java-tools ignores the User type because it is "orphan" as it is not referenced by any other type in the schema. However, this is a completely valid scenario, and would be great if graphql-java-tools could support it.
How to reproduce
I've created a simple project reproducing the issue: https://github.com/danilo-barboza/apollo-federation-java-tools/
Just clone it and run
./gradlew test
Possible solutions
I've also hacked hard and created a draft Pull Request to show a possible way to fix it: #441. The main idea is to make sure we add types that have the @extends annotation.
Possibly duplicate of #420?
@williamboman-pp thanks for pointing that out!
The issues seems indeed related, however this one is for the specific use case of Apollo Federation, while #420 is more generic about unnused types. If #420 is solved this is automatically solved as well, but not the other way around.
So I'll leave this one opens as, depending on the approach taken by maintainers.
This use case is also important on a project I'm working on. Would love to see a fix.
#445 looks like a simple way to opt into having all types returned (or to look at it differently, to opt out of having the schema pruned). Even if there is an intention to have a more sophisticated approach for the federation use case in the future, this would be a welcome approach for now.