-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Update execution docs #1804
Update execution docs #1804
Conversation
@mandiwise is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great content! Excellent work! 🙌
Co-authored-by: Benjie <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good to go - excellent work 🙌
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Notice that our type system claims `appearsIn` will return Enum types with known values, however, this function is returning numbers! Indeed if we look up at the result we'll see that the appropriate values for the Enum type are being returned. What's going on? | ||
|
||
This is an example of scalar coercion. The type system knows what to expect and will convert the values returned by a resolver function into something that upholds the API contract. In this case, there may be an Enum defined on our server which uses numbers like `4`, `5`, and `6` internally, but represents them as Enum values in the GraphQL type system. | ||
This is an example of _scalar coercion_. The type system knows what to expect and will convert the values returned by a resolver function into something that upholds the API contract. In this case, there may be an Enum type defined on our server that uses numbers like `4`, `5`, and `6` internally, but represents them as the expected values in the GraphQL type system. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mandiwise @benjie, this section is called Scalar coercion but an Enum is used as example. Since these are two separate types, conflating the two could lead to confusion for the readers.
I believe the spec uses the term Result coercion
to describe the concept in this section. Maybe the following minor changes could make it clearer:
- Changing
scalar coercion
toresult coercion
- Adding an example of the enum coercion implementation e.g.
Episode: {
NEWHOPE: 4
EMPIRE: 5
JEDI: 6
}
Sorry for the late comment, I just happen to see this PR after it's merged. I'm happy to make contributions if the above makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree the mix of scalar/enum is confusing and would love to see your suggested edits in a PR 👍
Co-authored-by: Benjie <[email protected]>
Co-authored-by: Benjie <[email protected]>
Description
This PR contains updated execution content for the Learn docs. Key changes include:
data
anderrors
keys in detail, including examples for different syntax, validation, and field error scenarios@benjie @jorydotcom