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

Preserve sources of variable values #3811

Merged
merged 4 commits into from
Sep 29, 2024

Conversation

yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Dec 31, 2022

#3077 rebased on main.

Depends on #3810

@leebyron comments from original PR:

By way of introducing type VariableValues, allows getVariableValues to return both the coerced values as well as the original sources, which are then made available in ExecutionContext.

While variable sources are not used directly here, they're used directly in #3065. This PR is pulled out as a pre-req to aid review

@netlify
Copy link

netlify bot commented Dec 31, 2022

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit c3e220d
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/66f871c7f6cad50008fb104c
😎 Deploy Preview https://deploy-preview-3811--compassionate-pike-271cb3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions
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
Copy link
Contributor Author

I guess this should technically be a BREAKING CHANGE as the signature changes for getVariableValues and that is now exported.

@yaacovCR yaacovCR added PR: breaking change 💥 implementation requires increase of "major" version number and removed PR: internal 🏠 labels Jan 12, 2023
src/execution/values.ts Outdated Show resolved Hide resolved
@yaacovCR yaacovCR force-pushed the variable-value-sources-rebased branch 2 times, most recently from 65145f9 to ce33974 Compare January 31, 2023 19:47
@yaacovCR yaacovCR force-pushed the variable-value-sources-rebased branch 5 times, most recently from 12f67c0 to d8feffe Compare February 6, 2023 12:53
@yaacovCR yaacovCR force-pushed the variable-value-sources-rebased branch 2 times, most recently from d8486ae to 2211b7a Compare May 31, 2023 11:38
@yaacovCR yaacovCR force-pushed the variable-value-sources-rebased branch from 2211b7a to 9f85bc3 Compare March 20, 2024 11:25
@yaacovCR yaacovCR force-pushed the variable-value-sources-rebased branch from 9f85bc3 to 2906851 Compare September 15, 2024 10:37
@yaacovCR yaacovCR requested a review from a team as a code owner September 15, 2024 10:37
@yaacovCR yaacovCR force-pushed the variable-value-sources-rebased branch 4 times, most recently from 9dfe0a9 to 3d8be34 Compare September 15, 2024 11:43
@yaacovCR yaacovCR force-pushed the variable-value-sources-rebased branch 4 times, most recently from 9e7a08b to 12f30ec Compare September 15, 2024 14:17
@yaacovCR yaacovCR force-pushed the variable-value-sources-rebased branch 6 times, most recently from 2fe5343 to 55b9361 Compare September 17, 2024 13:56
@yaacovCR yaacovCR mentioned this pull request Sep 27, 2024
16 tasks
leebyron and others added 4 commits September 29, 2024 00:14
By way of introducing type `VariableValues`, allows `getVariableValues` to return both the coerced values as well as the original sources, which are then made available in `ExecutionContext`.
breaking change, have to do it in v17 or would have to wait until v18
@yaacovCR yaacovCR force-pushed the variable-value-sources-rebased branch from 958681c to c3e220d Compare September 28, 2024 21:14
@yaacovCR yaacovCR merged commit 7dd825e into graphql:main Sep 29, 2024
20 checks passed
@yaacovCR yaacovCR deleted the variable-value-sources-rebased branch September 29, 2024 10:15
yaacovCR added a commit that referenced this pull request Sep 29, 2024
[#3065 rebased on
main](#3065).

Depends on #3811

@leebyron comments from original PR:

> **Provides the "Value to Literal" methods in this [data flow
chart](https://user-images.githubusercontent.com/50130/118379946-51ac5300-b593-11eb-839f-c483ecfbc875.png).**
> 
> * Adds `valueToLiteral()` which takes an external input value and
translates it to a literal, allowing for custom scalars to define this
behavior.
> 
> **This also adds important changes to Input Coercion, especially for
custom scalars:**
> 
> * The value provided to `parseLiteral` is now `ConstValueNode` and the
second `variables` argument has been removed. For all built-in scalars
this has no effect, but any custom scalars which use complex literals no
longer need to do variable reconciliation manually (in fact most do not
-- this has been an easy subtle bug to miss).
>   This behavior is possible with the addition of `replaceVariables`

Changes to the original:
1. Instead of changing the signature of `parseLiteral()`, a new method
`parseConstLiteral()` has been added with the simpler signature.
`parseLiteral()` has been marked for deprecation.
2. `replaceVariables()` has access to operation and fragment variables.

Co-authored-by: Lee Byron <lee.byron@robinhood.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: breaking change 💥 implementation requires increase of "major" version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants