-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[resolvers] Ensure __isTypeof
is only generated for implementing types (of Interfaces) or Union members
#10283
base: federation-fixes
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 61e6158 The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
__isTypeof
is only generated for implementing types (of Interfaces) or Union members__isTypeof
is only generated for implementing types (of Interfaces) or Union members
@@ -679,7 +694,6 @@ export class BaseResolversVisitor< | |||
protected _hasReferencedResolversUnionTypes = false; | |||
protected _hasReferencedResolversInterfaceTypes = false; | |||
protected _resolversUnionTypes: Record<string, string> = {}; | |||
protected _resolversUnionParentTypes: Record<string, string> = {}; |
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.
This is no longer used, so we can remove it now.
Description
Only implementing types (of Interfaces) or Union members need
__isTypeOf
to help pick the right type name for the responses. This PR implements this behaviour by only generating__isTypeOf
for said object types.This PR also introduces
_parsedSchemaMeta
to hold metadata about the schema. This can help with performance and reduces complexity because we only parse through the schema once to collect meta about the types, and use the collected meta for subsequent generation.Note: This is an re-implementation for #10138, because this will be released as a breaking change instead of a new config.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?