Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit87cc061

Browse files
jamesmacaulayleebyron
authored andcommitted
Clarify operation type and name requirements (graphql#441)
1 parenta13a862 commit87cc061

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎site/learn/Learn-Queries.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ You can see how the above query would be pretty repetitive if the fields were re
126126

127127
##Operation name
128128

129-
Up until now, we have been using a shorthand syntax where we omit both the`query` keyword and the query name, but in production apps it's useful to use these to make our code less ambiguous.
130-
You'll need these optional parts to a GraphQL operation if you want to execute something other than a query or pass dynamic variables.
129+
Up until now, we have been using a shorthand syntax where we omit both the`query` keyword and the query name, but in production apps it's useful to use these to make our code less ambiguous.
131130

132131
Here’s an example that includes the keyword`query` as_operation type_ and`HeroNameAndFriends` as_operation name_ :
133132

@@ -143,9 +142,9 @@ query HeroNameAndFriends {
143142
}
144143
```
145144

146-
The_operation type_ is either_query_,_mutation_, or_subscription_ and describes what type of operation you're intending to do.
145+
The_operation type_ is either_query_,_mutation_, or_subscription_ and describes what type of operation you're intending to do. The operation type is required unless you're using the query shorthand syntax, in which case you can't supply a name or variable definitions for your operation.
147146

148-
The_operation name_ is a meaningful and explicit name for your operation. Itcan beveryuseful for debugging and server-side logging reasons.
147+
The_operation name_ is a meaningful and explicit name for your operation. Itis only required in multi-operation documents, but its use is encouraged because it isveryhelpful for debugging and server-side logging.
149148
When something goes wrong either in your network logs or your GraphQL server, it is easier to identify a query in your codebase by name instead of trying to decipher the contents.
150149
Think of this just like a function name in your favorite programming language.
151150
For example, in JavaScript we can easily work only with anonymous functions, but when we give a function a name, it's easier to track it down, debug our code,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp