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

feat: fragment-arguments execution #6013

Closed
wants to merge 5 commits into from

Conversation

JoviDeCroock
Copy link

@JoviDeCroock JoviDeCroock commented Mar 23, 2024

Description

This implements the changes in execution required for the Fragment-Arguments spec proposed in graphql/graphql-spec#1081. This could be a way towards us testing this feature out in implementations like Yoga, ... We could publish it under a experimental-fragment-arguments tag.

I was trying to figure out how we could best either introduce a custom parser like we have in 0no-co/graphql.web#23 or use a branch of graphql-js. This mainly so we can run the tests 😅 the tests are currently copied from graphql-js in JoviDeCroock/graphql-js#2 and graphql/graphql-js#4015.

The changes for validation are still left open purposefully as that is the part of the spec I've gotten least feedback on. The main point that's open is whether we disallow spreads on the same fragment with different arguments, as there is currently no way to alias a fragment.

Not sure whether I did something wrong but it tells me that memoize3 isn't a function 😅

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

I have added tests in variables-test.ts and still have to add tests for overall execution from an integration point of view.

Checklist:

  • I have followed the
    CONTRIBUTING doc and the
    style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests and linter rules pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link

changeset-bot bot commented Mar 23, 2024

⚠️ No Changeset found

Latest commit: b604a15

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

@JoviDeCroock JoviDeCroock marked this pull request as ready for review April 3, 2024 04:38
variableValues?: { [variable: string]: unknown },
) {
// TODO: figure out how to do custom parser here
const document = parse(query, { experimentalFragmentArguments: true });
Copy link
Author

Choose a reason for hiding this comment

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

This is pending, how do we want to tackle having an alternative parser?

@@ -257,6 +256,7 @@ function visitObjectValue(
addPathSegmentInfo(type, fieldName, newPathIndex, fieldErrors, errorInfo);
}

// TODO: for fragment arguments we might need to update the variable-values here.
Copy link
Author

Choose a reason for hiding this comment

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

Wasn't sure here as I don't know some of these utils, looking deeper atm

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