-
Notifications
You must be signed in to change notification settings - Fork 0
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: execution for fragment arguments syntax #2
feat: execution for fragment arguments syntax #2
Conversation
Hi @JoviDeCroock, I'm @github-actions bot happy to help you with this PR 👋 Supported commandsPlease post this commands in separate comments and only one per comment:
|
7ffcd86
to
dde52d7
Compare
af53dbd
to
507e0dd
Compare
Yeah I realized (after I started) that we do need to preserve a two-layer “stack” of variables, a la the refactored context you’re describing. Substitution doesn’t cut it: I can’t remember all the details for WHY substitution doesn’t work (sounds like you’re learning them though!). Yes it would be a pretty large refactor, but I think that refactor is essentially required to make fragment arguments good. |
c343454
to
d5ad911
Compare
Overall I wonder if it would be nice to have some common GraphQLArgument/GraphQLSignature type similar to #7 that could unify some of the above logic. |
If it helps at all, I have rebased this branch on current main: https://github.com/yaacovCR/graphql-executor/tree/fragment-args-execution-2024-rebased |
Here is a commit that implements some parallel changes to what I suggested in the TypeInfo branch with precompiling the fragment variable signatures.... Also includes greater code reuse of getArgumentValues, but presently requires some JavaScript specific changes around non-provided variables, previously they did not appear at all in the args array, now they need to be present but undefined, so the code path for supplying the default field value takes precedence over the operation default value |
I was able to fix this on my scratch brainstorming branch: https://github.com/yaacovCR/graphql-executor/tree/execution-suggestions |
839284d
to
3918bb5
Compare
d5ad911
to
c8a97f7
Compare
branch https://github.com/yaacovCR/graphql-executor/tree/execution-suggestions has that commit rebased on main and then one additional commit showing you one potential set of changes that would be responsive to the feedback i am trying to give. Basically, in that branch:
|
c8a97f7
to
2d354bc
Compare
00af02d
to
1708107
Compare
1d24995
to
47ff0fb
Compare
5a2cba0
to
9f60aa8
Compare
Co-authored-by: mjmahone <[email protected]>
* 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
as it cannot be used by validation, which must collect all errors rather than fail with invalid type for signature
f9a1a69
into
fragment-args-syntax-2024
This is a rebase of #3847 This implements execution of Fragment Arguments, and more specifically visiting, parsing and printing of fragment-spreads with arguments and fragment definitions with variables, as described by the spec changes in graphql/graphql-spec#1081. There are a few amendments in terms of execution and keying the fragment-spreads, these are reflected in mjmahone/graphql-spec#3 The purpose is to be able to independently review all the moving parts, the stacked PR's will contain mentions of open feedback that was present at the time. - [execution changes](JoviDeCroock#2) - [TypeInfo & validation changes](JoviDeCroock#4) - [validation changes in isolation](JoviDeCroock#5) CC @mjmahone the original author --------- Co-authored-by: mjmahone <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]>
This implements execution of Fragment Arguments, and more specifically collecting-fields and replacing the variables in a fragment-definition with values coming from the fragment-spread, as described by the spec changes in graphql/graphql-spec#1010.
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.