Skip to content

feat: executing documents containing fragment-arguments #1

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

Closed

Conversation

JoviDeCroock
Copy link
Owner

@JoviDeCroock JoviDeCroock commented Jan 27, 2024

This is a 2024 update of graphql#3835 where all discussions have been carried over in code comments, they are highlighted already as review comments here as well.

This PR splits out the execution part so we can look at that in detail, I will pause here as the fragment-keying remarks will most likely have quite an impact on the validation changes.

Copy link

Hi @JoviDeCroock, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

// replacing an unset fragment argument with an operation
// variable value. Fragment arguments must always have LOCAL scope.
//
// TODO: To remove this hack, we need to either:
Copy link
Owner Author

Choose a reason for hiding this comment

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

The issue here presents itself in that fragments can define arguments like

fragment x($id: ID!) on Y { todo(id: $id) { text } }

Which can be passed in through fragment spreads

...x(id: '2')

now what happens when we spread x and there is an $id present on the document itself, if we aren't using __UNSET it would leverage that one which we don't want. There might be a better solution in carrying variables around as we visit the FragmentSpread and the accompanying FragmentDefinition

import type { FragmentSpreadNode } from '../language/ast.js';
import { print } from '../language/printer.js';

// TODO: follow up on https://github.com/graphql/graphql-js/pull/3835/files#r1100999816
Copy link
Owner Author

Choose a reason for hiding this comment

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

@JoviDeCroock JoviDeCroock force-pushed the fragment-args-execution-2024 branch from 73a13f3 to 8f3f760 Compare January 27, 2024 09:05
@JoviDeCroock JoviDeCroock force-pushed the fragment-args-execution-2024 branch from 8f3f760 to e2d8d2d Compare January 27, 2024 10:40
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