-
Notifications
You must be signed in to change notification settings - Fork 2k
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 defaultValue literals #3810
Merged
yaacovCR
merged 1 commit into
graphql:main
from
yaacovCR:default-value-literals-rebased
Sep 23, 2024
Merged
Preserve defaultValue literals #3810
yaacovCR
merged 1 commit into
graphql:main
from
yaacovCR:default-value-literals-rebased
Sep 23, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for compassionate-pike-271cb3 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hi @yaacovCR, 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:
|
yaacovCR
force-pushed
the
default-value-literals-rebased
branch
from
December 31, 2022 19:52
f7d4e56
to
4883f29
Compare
yaacovCR
force-pushed
the
default-value-literals-rebased
branch
from
January 1, 2023 19:36
4883f29
to
023cd9c
Compare
yaacovCR
force-pushed
the
default-value-literals-rebased
branch
5 times, most recently
from
February 6, 2023 12:52
cafef7b
to
7a927c5
Compare
yaacovCR
force-pushed
the
default-value-literals-rebased
branch
2 times, most recently
from
May 31, 2023 11:36
c3fc46d
to
0376313
Compare
yaacovCR
force-pushed
the
default-value-literals-rebased
branch
from
March 20, 2024 11:01
0376313
to
619c450
Compare
yaacovCR
force-pushed
the
default-value-literals-rebased
branch
from
September 14, 2024 20:54
619c450
to
fd87704
Compare
yaacovCR
force-pushed
the
default-value-literals-rebased
branch
8 times, most recently
from
September 15, 2024 11:42
7c8cc2c
to
47081cb
Compare
yaacovCR
force-pushed
the
default-value-literals-rebased
branch
from
September 16, 2024 17:27
47081cb
to
f6feca9
Compare
yaacovCR
force-pushed
the
default-value-literals-rebased
branch
4 times, most recently
from
September 17, 2024 12:20
0439857
to
52aa101
Compare
Fixes graphql#3051 This change solves the problem of default values defined via SDL not always resolving correctly through introspection by preserving the original GraphQL literal in the schema definition. This changes argument and input field definitions `defaultValue` field from just the "value" to a new `GraphQLDefaultValueUsage` type which contains either -- but not both -- "value" and "literal" fields. Here is the flow for how a default value defined in an SDL would be converted into a functional schema and back to an SDL: **Before this change:** ``` (SDL) --parse-> (AST) --coerceInputLiteral--> (defaultValue config) --valueToAST--> (AST) --print --> (SDL) ``` `coerceInputLiteral` performs coercion which is a one-way function, and `valueToAST` is unsafe and set to be deprecated in graphql#3049. **After this change:** ``` (SDL) --parse-> (defaultValue literal config) --print --> (SDL) ```
yaacovCR
force-pushed
the
default-value-literals-rebased
branch
from
September 17, 2024 13:56
52aa101
to
fdce4b2
Compare
JoviDeCroock
approved these changes
Sep 18, 2024
yaacovCR
added
PR: breaking change 💥
implementation requires increase of "major" version number
and removed
PR: bug fix 🐞
requires increase of "patch" version number
labels
Sep 23, 2024
Just changing the label on this. This is a bug fix, but it also changes the type/structure of the |
yaacovCR
added a commit
that referenced
this pull request
Sep 29, 2024
[#3077 rebased on main](#3077). 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 --------- Co-authored-by: Lee Byron <lee.byron@robinhood.com>
yaacovCR
added a commit
that referenced
this pull request
Oct 27, 2024
[#3049 rebased on main](#3049). This is the last rebased PR from the original PR stack concluding with #3049. * Rebased: #3809 [Original: #3092] * Rebased: #3810 [Original: #3074] * Rebased: #3811 [Original: #3077] * Rebased: #3812 [Original: #3065] * Rebased: #3813 [Original: #3086] * Rebased: #3814 (this PR) [Original: #3049] Update: #3044 and #3145 have been separated from this stack. Changes from original PR: 1. `astFromValue()` is deprecated instead of being removed. @leebyron comments from #3049, the original PR: > Implements [graphql/graphql-spec#793](graphql/graphql-spec#793) > > * BREAKING: Changes default values from being represented as an assumed-coerced "internal input value" to a pre-coerced "external input value" (See chart below). > This allows programmatically provided default values to be represented in the same domain as values sent to the service via variable values, and allows it to have well defined methods for both transforming into a printed GraphQL literal string for introspection / schema printing (via `valueToLiteral()`) or coercing into an "internal input value" for use at runtime (via `coerceInputValue()`) > To support this change in value type, this PR adds two related behavioral changes: > > * Adds coercion of default values from external to internal at runtime (within `coerceInputValue()`) > * Removes `astFromValue()`, replacing it with `valueToLiteral()` for use in introspection and schema printing. `astFromValue()` performed unsafe "uncoercion" to convert an "Internal input value" directly to a "GraphQL Literal AST", where `valueToLiteral()` performs a well defined transform from "External input value" to "GraphQL Literal AST". > * Adds validation of default values during schema validation. > Since assumed-coerced "internal" values may not pass "external" validation (for example, Enum values), an additional validation error has been included which attempts to detect this case and report a strategy for resolution. > > Here's a broad overview of the intended end state: > > ![GraphQL Value Flow](https://user-images.githubusercontent.com/50130/118379946-51ac5300-b593-11eb-839f-c483ecfbc875.png) --------- Co-authored-by: Lee Byron <lee@leebyron.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#3074 rebased on main.
Depends on #3809
@leebyron comments from original PR (edited, hopefully correctly):