-
-
Notifications
You must be signed in to change notification settings - Fork 810
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance(stitching): increase key flexibility when type merging (#1888)
* demonstrate merging of federated-like schemas * enhance(stitching): only add necessary keys also consolidates equivalent selections add memoization This could be optimized differently: if there was a mapping of fields within the gateway schema to the subschemas containing those fields, we could instead iterate through the document and collect the originating subschemas and then add the keys for each of those subschemas. This method seems possibly about as good. * refactor: rename variable to be more descriptive * enhance(typeMerging): expand allowed keys allow keys whose source data is spread across multiple schemas * fix(selectionSets): only spread correct fragments * refactor(typeMerging): reduce memoization arguments * enhance(stitching): consolidate selections * proof of concept? * fix * enhance(typeMerging): prune fields that cause key fields to be added key fields for a given subschema by definition must be resolved outside that subschema, and so for any given key field, there is no need to add the other key fields to the selectionSet or to consider the key field as proxiable via that subschema. The key field is the "key" to the remaining fields, but -- for the purposes of type merging -- will never be obtained from the given subschema. This becomes more complex with non-leaf key fields, and so this pruning is enabled only for leaf key fields. * fix * change example to favor input object type over scalar see #1888 (review)
- Loading branch information
Showing
11 changed files
with
303 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 73 additions & 20 deletions
93
packages/delegate/src/results/memoize.ts → packages/delegate/src/memoize.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.