Skip to content
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

fix(schema-first): merge duplicate IQuery interface #2353

Conversation

katainaka0503
Copy link
Contributor

@katainaka0503 katainaka0503 commented Aug 25, 2022

Fixes #2344

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #2344

As described in the issue, GraphQLFederationDefinitionsFactory emits duplicate IQuery interface.

This is caused by buildSubgraphSchema, which fills empty Query definition when there is no original type Query definition and there is extend type Query definition.

What is the new behavior?

Duplicate IQuery interface will be merged.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@@ -35,9 +36,17 @@ export class GraphQLFederationDefinitionsFactory extends GraphQLDefinitionsFacto
resolvers: {},
},
]);

const mergedDefinition = mergeTypeDefs([printSubgraphSchema(schema)], {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a comment explaining why this is needed? (with a link to the original issue)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that such a comment should be here. I'll add it.

@kamilmysliwiec kamilmysliwiec merged commit ca8cabb into nestjs:master Sep 1, 2022
@katainaka0503 katainaka0503 deleted the fix-duplicate-query-in-federated-query branch September 2, 2022 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Schema first code generation creates duplicate IQuery interfaces
2 participants