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

suggestions for execution #11

Conversation

yaacovCR
Copy link
Collaborator

@yaacovCR yaacovCR commented Aug 25, 2024

The main purpose of this PR is to:

  1. re-use the exact same logic for retrieving arguments for a field as for retrieving arguments for a fragment, i.e. removing the separate getArgumentValuesFromSpread function
  2. avoid coalescing localVariableValues and global variableValues into a new map, instead passing them both to the relevant functions
  3. avoid any breaking changes by way of introducing an experimentalGetArgumentValues function that can operate on Field nodes, Directive nodes, or Fragment spread nodes. (Parenthetically, the new function is only necessary because Field and Directive definitions store their arguments under args and Variable Definitions store them under arguments. Need for the new function would be removed if we just checked inside the function what we are passed and selected args or arguments, but this way in v18 or v19 or v20 we can switch to the new function and have the caller just pick out the args from the definition on their own.)

This also relies on the so that we re-use the same logic for operation variables and fragment variables

Copy link

Hi @yaacovCR, 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

@yaacovCR yaacovCR force-pushed the execution-suggestions branch 2 times, most recently from 2be8214 to b83db68 Compare August 25, 2024 11:43
@JoviDeCroock JoviDeCroock force-pushed the fragment-args-execution-2024 branch 2 times, most recently from 1d24995 to 47ff0fb Compare August 25, 2024 11:50
@yaacovCR yaacovCR force-pushed the execution-suggestions branch 2 times, most recently from b66f57a to 666ef15 Compare August 25, 2024 11:57
@yaacovCR
Copy link
Collaborator Author

description updated above.

@yaacovCR
Copy link
Collaborator Author

also here and there just minimizes the diff with main on graphq-js

@JoviDeCroock JoviDeCroock merged commit d9bc448 into JoviDeCroock:fragment-args-execution-2024 Aug 25, 2024
14 of 15 checks passed
@yaacovCR yaacovCR deleted the execution-suggestions branch August 25, 2024 13:00
JoviDeCroock pushed a commit that referenced this pull request Aug 30, 2024
* add directive test

* add failing test

add additional nested fragment test (#8)

Correct test and lint stuff

suggestions for execution (#11)

* introduce internal getVariableSignature utility

now extracted also to graphql-js PR, see graphql#4175

* execution suggestions

fixes execution to always use fragment variable when has the same name as an operation variable

previously, we were allowing an operation variable to be used if the fragment variable was not provided, and the field had no default. Now, we still use the fragment variable, and so the value is null.

this now correct logic allows us to significantly reduce the diff from main

adds additional test
JoviDeCroock pushed a commit that referenced this pull request Aug 30, 2024
* add directive test

* add failing test

add additional nested fragment test (#8)

Correct test and lint stuff

suggestions for execution (#11)

* introduce internal getVariableSignature utility

now extracted also to graphql-js PR, see graphql#4175

* execution suggestions

fixes execution to always use fragment variable when has the same name as an operation variable

previously, we were allowing an operation variable to be used if the fragment variable was not provided, and the field had no default. Now, we still use the fragment variable, and so the value is null.

this now correct logic allows us to significantly reduce the diff from main

adds additional test
JoviDeCroock pushed a commit that referenced this pull request Aug 30, 2024
* add directive test

* add failing test

add additional nested fragment test (#8)

Correct test and lint stuff

suggestions for execution (#11)

* introduce internal getVariableSignature utility

now extracted also to graphql-js PR, see graphql#4175

* execution suggestions

fixes execution to always use fragment variable when has the same name as an operation variable

previously, we were allowing an operation variable to be used if the fragment variable was not provided, and the field had no default. Now, we still use the fragment variable, and so the value is null.

this now correct logic allows us to significantly reduce the diff from main

adds additional test
JoviDeCroock added a commit that referenced this pull request Sep 4, 2024
* implement execution for fragment arguments syntax

Co-authored-by: mjmahone <mahoney.mattj@gmail.com>

* add directive test (#9)

* add directive test

* add failing test

add additional nested fragment test (#8)

Correct test and lint stuff

suggestions for execution (#11)

* introduce internal getVariableSignature utility

now extracted also to graphql-js PR, see graphql#4175

* execution suggestions

fixes execution to always use fragment variable when has the same name as an operation variable

previously, we were allowing an operation variable to be used if the fragment variable was not provided, and the field had no default. Now, we still use the fragment variable, and so the value is null.

this now correct logic allows us to significantly reduce the diff from main

adds additional test

* move getVariableSignature to execution

as it cannot be used by validation, which must collect all errors rather than fail with invalid type for signature

---------

Co-authored-by: mjmahone <mahoney.mattj@gmail.com>
Co-authored-by: Yaacov Rydzinski <yaacovCR@gmail.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.

2 participants