@@ -63,31 +63,35 @@ Note: many examples below will use the query shorthand syntax.
63
63
64
64
## Fields
65
65
66
- A field in the top-level selection set often represents some kind of
67
- information that is globally accessible to your application and the current
68
- viewer. Some typical examples of global fields:
66
+ Fields represent information that is accessible to your application. Some
67
+ typical examples include:
69
68
70
69
``` graphql
71
70
# `me` could represent the currently logged in user.
72
71
query getMe {
73
72
me {
74
- # ...
73
+ name
75
74
}
76
75
}
77
76
78
77
# `user` represents one of many users in a graph of data.
79
78
query getZuck {
80
79
user (id : 4 ) {
81
- # ...
80
+ name
82
81
}
83
82
}
84
83
```
85
84
85
+ In these examples, ` me ` and ` user ` are top-level fields that represent globally
86
+ accessible data and ` name ` is a subfield that represents data on a particular
87
+ object.
88
+
86
89
## Field Selections
87
90
88
- Each field is of a specific type, and the sub-fields must always be explicitly
89
- declared via a field selection, unless it is a scalar. For example, when
90
- fetching data from some user object:
91
+ Each field is of a specific type, and the subfields must always be explicitly
92
+ declared via a field selection, unless the field is a scalar. For example, when
93
+ fetching data from some user object each desired subfield must be requested
94
+ explicitly:
91
95
92
96
``` graphql
93
97
query getZuck {
@@ -99,6 +103,10 @@ query getZuck {
99
103
}
100
104
```
101
105
106
+ In this query, the ` id ` , ` firstname ` , and ` lastname ` fields form the selection
107
+ set of the ` user ` field. The top-level selection set is ` user ` , but could also
108
+ include other top-level fields.
109
+
102
110
Field selections can be further composed to explicitly state all subfields of
103
111
nested types. All queries must specify down to scalar fields.
104
112
0 commit comments