-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[federation][resolvers] Add generateInternalResolversIfNeeded. __resolveReference
to generate __resolveReference
only when resolvable
#9989
Merged
eddeee888
merged 11 commits into
master
from
federation-no-resolve-reference-if-not-resolvable
Oct 8, 2024
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4831bfb
Handle resolvable:false in federation entities
eddeee888 f8965de
Fix naming
eddeee888 1332e8b
Refactor and remove extraneous test
eddeee888 3b21974
Add changeset
eddeee888 9e8c92d
Clean up typing
eddeee888 06035ca
Fix typing issue for GraphQL 15
eddeee888 3034c9a
Ensure no federation: undefined case
eddeee888 89be355
Use consistent typing for meta
eddeee888 587899f
Use _federation to keep track of its meta
eddeee888 479c1af
Merge branch 'master' into federation-no-resolve-reference-if-not-res…
eddeee888 5103ffd
Merge branch 'master' into federation-no-resolve-reference-if-not-res…
eddeee888 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
'@graphql-codegen/visitor-plugin-common': minor | ||
'@graphql-codegen/typescript-resolvers': minor | ||
'@graphql-codegen/plugin-helpers': minor | ||
--- | ||
|
||
Add `generateInternalResolversIfNeeded` option | ||
|
||
This option can be used to generate more correct types for internal resolvers. For example, only generate `__resolveReference` if the federation object has a resolvable `@key`. | ||
|
||
In the future, this option can be extended to support other internal resolvers e.g. `__isTypeOf` is only generated for implementing types and union members. |
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.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, whenever there's a type with
__resolveReference
, this will be set totrue
.Instead of a
boolean
, we now want to track all the types with generated__resolveReference
types as outputmeta
, so downstream consumers (e.g. Server Preset) can easily use it.The
ApolloFederation
class now tracks this metadata.I could just put it here as a property of the plugin e.g.
_federationMeta
but it seems likeApolloFederation
is supposed to handle federation concerns. Happy to discuss if needed.