fix: Force add 'orphan' types used by apollo federation to schema #441
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Resolves #442
Checklist
Description
As described in #442, the main issue is that, for some Apollo Federation contexts, it is possible to have "orphan" types that are not referenced by any other types in the schema/graph.
This is a very naive attempt to fix it by making sure we add types with the
@extendsdirective, but asking clients to specify the type of it in theSchemaParserDictionary.It's marked as a draft because it is mostly to highlight the issue, but I'm looking to get for some pointers in order to a proper fix for it.
Possible things to consider on the real fix:
handleInterfaceOrUnionSubTypesto be more generic (maybe just rename it? or reuse the generic parts?)javaTypefor the extend entity types automatically as it is done for the other types.