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
Add example of variable coercion failure #289
base: main
Are you sure you want to change the base?
Conversation
Adds a concrete example to the variable coercion error
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.
Excellent first step! I've fixed the syntax in the request and since it's a bit longer that the other examples I've broken it out into a code block. I've also made it clear that the example is well-formed to help readers understand the distinction. What do you think?
Co-authored-by: Benjie <benjie@jemjie.com>
Excellent; please sign the CLA so that we can accept your contribution ❤️ |
We need to copy the RFC labels from the spec repo. I see this as an editorial change; assuming there's no concerns raised in the next couple weeks I think we should merge it. cc @abernix @balshor @benjie @deinok @ErikWittern @jaydenseric @michaelstaib @mike-marcacci @mmatsa @Shane32 @sjparsons @spawnia @sungam3r @Touchstone117 @enisdenjo @JoviDeCroock |
spec/GraphQLOverHTTP.md
Outdated
|
||
```json | ||
{ | ||
"query": "query getItem($id: String!) { item(id: $id) { id } }", |
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.
"query": "query getItem($id: String!) { item(id: $id) { id } }", | |
"query": "query ItemName($id: ID!) { item(id: $id) { id name } }", |
The example works fine as is. However, I think it is more common to use PascalCase for operation names, and I also think it is best practice to use the ID type for identifiers.
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 it is more common to use PascalCase for operation names
Perhaps; but I usually see schemas that follow this: https://www.apollographql.com/docs/technotes/TN0002-schema-naming-conventions/
I also think it is best practice to use the ID type for identifiers.
Agree
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.
https://www.apollographql.com/docs/technotes/TN0002-schema-naming-conventions/ does not explicitly talk about operation names, but its examples do use PascalCase (query Products
).
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 actually went through the spec and extracted the conventions from that; results are here:
https://benjie.dev/graphql/naming
The spec uses a mixture for operation names but camelCase is more common than UpperCamelCase. You may find the part on fragments interesting because I had a conversation with Lee about 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.
I tweaked your example and committed that, I added a get
prefix to match spec examples such as getDogName
https://spec.graphql.org/draft/#example-069e1
Co-authored-by: Benedikt Franke <benedikt@franke.tech>
Adds a concrete example to the variable coercion error