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

repro bug with repeated fragments spreads and generate query fragments #3042

Closed

Conversation

xuorig
Copy link
Contributor

@xuorig xuorig commented Jun 19, 2024

generateQueryFragments does't handle repeated (... on B { ... on B ... on B } } }) fragments well. Given the query planner can actually generate these query structures, this causes this option to be potentially dangerous, generating invalid subgraph queries.

A failing test is included.

@xuorig xuorig requested a review from a team as a code owner June 19, 2024 14:38
Copy link

netlify bot commented Jun 19, 2024

👷 Deploy request for apollo-federation-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 9238c8b

Copy link

changeset-bot bot commented Jun 19, 2024

⚠️ No Changeset found

Latest commit: 9238c8b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.


const withGeneratedFragments = operation.generateQueryFragments();
expect(withGeneratedFragments.toString()).toMatchString(`
{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ignore this expectation, the test fails due to validation errors before this.

clenfest added a commit that referenced this pull request Jun 20, 2024
Fixes #3042 

generateQueryFragments does't handle repeated (... on B { ... on B ...
on B } } }) fragments well. Given the query planner can actually
generate these query structures, this causes this option to be
potentially dangerous, generating invalid subgraph queries.

---------

Co-authored-by: Marc-Andre Giroux <mgiroux@netflix.com>
Meschreiber pushed a commit that referenced this pull request Jul 9, 2024
Fixes #3042 

generateQueryFragments does't handle repeated (... on B { ... on B ...
on B } } }) fragments well. Given the query planner can actually
generate these query structures, this causes this option to be
potentially dangerous, generating invalid subgraph queries.

---------

Co-authored-by: Marc-Andre Giroux <mgiroux@netflix.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant