Skip to content

Commit e36b4b1

Browse files
committed
Editorialize change sites
I went through this editorial in two passes. One where I tuned the usage of "operation", "request", and "selection set". I hopefully made these spots slightly clearer, but I'm open to feedback. Second pass was more freeform prose edits in cases where I thought the intended ideas could have been clearer and avoid the query ambiguity in the first place.
1 parent 55081b7 commit e36b4b1

7 files changed

+62
-60
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ move forward. See editor Lee Byron talk about
5151

5252
Once a query is written, it should always mean the same thing and return the
5353
same shaped result. Future changes should not change the meaning of existing
54-
schema or operations or in any other way cause an existing compliant GraphQL
54+
schema or requests or in any other way cause an existing compliant GraphQL
5555
service to become non-compliant for prior versions of the spec.
5656

5757
* **Performance is a feature**

spec/Section 2 -- Language.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ under-fetching data.
337337
}
338338
```
339339

340-
In this query operation, the `id`, `firstName`, and `lastName` fields form a selection
341-
set. Selection sets may also contain fragment references.
340+
In this query operation, the `id`, `firstName`, and `lastName` fields form a
341+
selection set. Selection sets may also contain fragment references.
342342

343343

344344
## Fields
@@ -408,7 +408,7 @@ Fields are conceptually functions which return values, and occasionally accept
408408
arguments which alter their behavior. These arguments often map directly to
409409
function arguments within a GraphQL service's implementation.
410410

411-
In this example, we want to fetch a specific user (requested via the `id`
411+
In this example, we want to query a specific user (requested via the `id`
412412
argument) and their profile picture of a specific `size`:
413413

414414
```graphql example
@@ -1096,7 +1096,9 @@ If not defined as constant (for example, in {DefaultValue}), a {Variable} can be
10961096
supplied for an input value.
10971097

10981098
Variables must be defined at the top of an operation and are in scope
1099-
throughout the execution of that operation.
1099+
throughout the execution of that operation. Values for those variables are
1100+
provided to a GraphQL service as part of a request so they may be substituted
1101+
in during execution.
11001102

11011103
In this example, we want to fetch a profile picture size based on the size
11021104
of a particular device:
@@ -1111,10 +1113,8 @@ query getZuckProfile($devicePicSize: Int) {
11111113
}
11121114
```
11131115

1114-
Values for those variables are provided to a GraphQL service along with a
1115-
request so they may be substituted during execution. If providing JSON for the
1116-
variables' values, we could run this operation and fetch profilePic of
1117-
size `60` width:
1116+
If providing JSON for the variables' values, we could request a `profilePic` of
1117+
size `60`:
11181118

11191119
```json example
11201120
{
@@ -1124,11 +1124,10 @@ size `60` width:
11241124

11251125
**Variable use within Fragments**
11261126

1127-
Operation variables can be used within fragments. Operation variables have global scope
1128-
with a given operation, so a variable used within a fragment must be declared
1129-
in any top-level operation that transitively consumes that fragment. If
1130-
a variable is referenced in a fragment and is included by an operation that does
1131-
not define that variable, the operation cannot be executed.
1127+
Variables can be used within fragments. Variables have global scope with a given operation, so a variable used within a fragment must be declared in any
1128+
top-level operation that transitively consumes that fragment. If a variable is
1129+
referenced in a fragment and is included by an operation that does not define
1130+
that variable, that operation is invalid (see [All Variable Uses Defined](#sec-All-Variable-Uses-Defined)).
11321131

11331132

11341133
## Type References
@@ -1146,9 +1145,9 @@ NonNullType :
11461145
- NamedType !
11471146
- ListType !
11481147

1149-
GraphQL describes the types of data expected by operation variables. Input types
1150-
may be lists of another input type, or a non-null variant of any other
1151-
input type.
1148+
GraphQL describes the types of data expected by arguments and variables.
1149+
Input types may be lists of another input type, or a non-null variant of any
1150+
other input type.
11521151

11531152
**Semantics**
11541153

@@ -1188,8 +1187,8 @@ including or skipping a field. Directives provide this by describing additional
11881187
Directives have a name along with a list of arguments which may accept values
11891188
of any input type.
11901189

1191-
Directives can be used to describe additional information for types, fields, fragments
1192-
and operations.
1190+
Directives can be used to describe additional information for types, fields,
1191+
fragments and operations.
11931192

11941193
As future versions of GraphQL adopt new configurable execution capabilities,
11951194
they may be exposed via directives. GraphQL services and tools may also provide

spec/Section 3 -- Type System.md

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Type System
22

33
The GraphQL Type system describes the capabilities of a GraphQL service and is
4-
used to determine if a request is valid. The type system also describes the
5-
input types of operation variables to determine if values provided at runtime
6-
are valid.
4+
used to determine if a requested operation is valid, to guarantee the type of
5+
response results, and describes the input types of variables to determine if
6+
values provided at request time are valid.
77

88
TypeSystemDocument : TypeSystemDefinition+
99

@@ -424,8 +424,8 @@ raised (input values are validated before execution begins).
424424

425425
GraphQL has different constant literals to represent integer and floating-point
426426
input values, and coercion rules may apply differently depending on which type
427-
of input value is encountered. GraphQL may be parameterized by operation variables,
428-
the values of which are often serialized when sent over a transport like HTTP. Since
427+
of input value is encountered. GraphQL may be parameterized by variables, the
428+
values of which are often serialized when sent over a transport like HTTP. Since
429429
some common serializations (ex. JSON) do not discriminate between integer
430430
and floating-point values, they are interpreted as an integer input value if
431431
they have an empty fractional part (ex. `1.0`) and otherwise as floating-point
@@ -601,14 +601,15 @@ FieldsDefinition : { FieldDefinition+ }
601601

602602
FieldDefinition : Description? Name ArgumentsDefinition? : Type Directives[Const]?
603603

604-
GraphQL operations are hierarchical and composed, describing a tree of information.
605-
While Scalar types describe the leaf values of these hierarchical operations, Objects
606-
describe the intermediate levels.
604+
GraphQL operations are hierarchical and composed, describing a tree of
605+
information. While Scalar types describe the leaf values of these hierarchical
606+
operations, Objects describe the intermediate levels.
607607

608608
GraphQL Objects represent a list of named fields, each of which yield a value of
609609
a specific type. Object values should be serialized as ordered maps, where the
610-
requested field names (or aliases) are the keys and the result of evaluating
611-
the field is the value, ordered by the order in which they appear in the operation.
610+
selected field names (or aliases) are the keys and the result of evaluating
611+
the field is the value, ordered by the order in which they appear in
612+
the selection set.
612613

613614
All fields defined within an Object type must not have a name which begins with
614615
{"__"} (two underscores), as this is used exclusively by GraphQL's
@@ -687,8 +688,8 @@ type Person {
687688
}
688689
```
689690

690-
Valid operations must supply a nested field set for a field that returns
691-
an object, so this operation is not valid:
691+
Valid operations must supply a nested field set for any field that returns an
692+
object, so this operation is not valid:
692693

693694
```graphql counter-example
694695
{
@@ -722,7 +723,7 @@ And will yield the subset of each object type queried:
722723
**Field Ordering**
723724

724725
When querying an Object, the resulting mapping of fields are conceptually
725-
ordered in the same order in which they were encountered during request execution,
726+
ordered in the same order in which they were encountered during execution,
726727
excluding fragments for which the type does not apply and fields or
727728
fragments that are skipped via `@skip` or `@include` directives. This ordering
728729
is correctly produced when using the {CollectFields()} algorithm.
@@ -920,7 +921,7 @@ type Person {
920921
}
921922
```
922923

923-
GraphQL operations can optionally specify arguments to their fields to provide
924+
Operations can optionally specify arguments to their fields to provide
924925
these arguments.
925926

926927
This example operation:
@@ -932,7 +933,7 @@ This example operation:
932933
}
933934
```
934935

935-
May yield the result:
936+
May return the result:
936937

937938
```json example
938939
{
@@ -948,9 +949,9 @@ Object, Interface, or Union type).
948949
### Field Deprecation
949950

950951
Fields in an object may be marked as deprecated as deemed necessary by the
951-
application. It is still legal to fetch these fields (to ensure existing
952-
clients are not broken by the change), but the fields should be appropriately
953-
treated in documentation and tooling.
952+
application. It is still legal to include these fields in a selection set
953+
(to ensure existing clients are not broken by the change), but the fields should
954+
be appropriately treated in documentation and tooling.
954955

955956
When using the type system definition language, `@deprecated` directives are
956957
used to indicate that a field is deprecated:
@@ -1294,11 +1295,9 @@ type SearchQuery {
12941295
}
12951296
```
12961297

1297-
When querying the `firstSearchResult` field of type `SearchQuery`, the
1298-
request would ask for all fields inside of a fragment indicating the appropriate
1299-
type. If the request wanted the name if the result was a Person, and the height if
1300-
it was a photo, the following document is invalid, because the union itself
1301-
defines no fields:
1298+
In this example, a query operation wants the name if the result was a Person,
1299+
and the height if it was a photo. However because a union itself defines no
1300+
fields, this could be ambiguous and is invalid.
13021301

13031302
```graphql counter-example
13041303
{
@@ -1309,7 +1308,7 @@ defines no fields:
13091308
}
13101309
```
13111310

1312-
Instead, the document would be:
1311+
A valid operation includes typed fragments (in this example, inline fragments):
13131312

13141313
```graphql example
13151314
{
@@ -1415,7 +1414,7 @@ reasonable coercion is not possible they must raise a field error.
14151414
GraphQL has a constant literal to represent enum input values. GraphQL string
14161415
literals must not be accepted as an enum input and instead raise a request error.
14171416

1418-
Operation variable transport serializations which have a different representation
1417+
Variable transport serializations which have a different representation
14191418
for non-string symbolic values (for example, [EDN](https://github.com/edn-format/edn))
14201419
should only allow such values as enum input values. Otherwise, for most
14211420
transport serializations that do not, strings may be interpreted as the enum
@@ -1709,9 +1708,9 @@ exclamation mark is used to denote a field that uses a Non-Null type like this:
17091708

17101709
**Nullable vs. Optional**
17111710

1712-
Fields are *always* optional within the context of a selection set, a field may be
1713-
omitted and the selection set is still valid. However fields that return Non-Null types
1714-
will never return the value {null} if queried.
1711+
Fields are *always* optional within the context of a selection set, a field may
1712+
be omitted and the selection set is still valid. However fields that return
1713+
Non-Null types will never return the value {null} if queried.
17151714

17161715
Inputs (such as field arguments), are always optional by default. However a
17171716
non-null input type is required. In addition to not accepting the value {null},

spec/Section 4 -- Introspection.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type User {
1616
}
1717
```
1818

19-
The operation
19+
A request containing the operation:
2020

2121
```graphql example
2222
{
@@ -32,7 +32,7 @@ The operation
3232
}
3333
```
3434

35-
would return
35+
would produce the result:
3636

3737
```json example
3838
{
@@ -259,7 +259,7 @@ Fields
259259
* `kind` must return `__TypeKind.OBJECT`.
260260
* `name` must return a String.
261261
* `description` may return a String or {null}.
262-
* `fields`: The set of fields request-able on this type.
262+
* `fields`: The set of fields that can be selected for this type.
263263
* Accepts the argument `includeDeprecated` which defaults to {false}. If
264264
{true}, deprecated fields are also returned.
265265
* `interfaces`: The set of interfaces that an object implements.

spec/Section 5 -- Validation.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,8 @@ Conversely the leaf field selections of GraphQL operations
606606
must be of type scalar or enum. Leaf selections on objects, interfaces,
607607
and unions without subfields are disallowed.
608608

609-
Let's assume the following additions to the query root operation type of the schema:
609+
Let's assume the following additions to the query root operation type of
610+
the schema:
610611

611612
```graphql example
612613
extend type Query {
@@ -861,7 +862,7 @@ fragment fragmentOne on Dog {
861862

862863
Fragments must be specified on types that exist in the schema. This
863864
applies for both named and inline fragments. If they are
864-
not defined in the schema, the request does not validate.
865+
not defined in the schema, the fragment is invalid.
865866

866867
For example the following fragments are valid:
867868

@@ -1506,7 +1507,8 @@ query ($foo: Boolean = true, $bar: Boolean = false) {
15061507
```
15071508

15081509
However the following example is valid because `@skip` has been used only once
1509-
per location, despite being used twice in the document and on the same named field:
1510+
per location, despite being used twice in the operation and on the same
1511+
named field:
15101512

15111513
```raw graphql example
15121514
query ($foo: Boolean = true, $bar: Boolean = false) {

spec/Section 6 -- Execution.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ it must also provide a mutation or subscription root operation type, respectivel
118118
### Query
119119

120120
If the operation is a query, the result of the operation is the result of
121-
executing the operation’s top level selection set with the query root operation type.
121+
executing the operation’s top level selection set with the query root
122+
operation type.
122123

123124
An initial value may be provided when executing a query operation.
124125

@@ -562,8 +563,8 @@ Fields may include arguments which are provided to the underlying runtime in
562563
order to correctly produce a value. These arguments are defined by the field in
563564
the type system to have a specific input type.
564565

565-
At each argument position in an operation may be a literal {Value}, or a {Variable}
566-
to be provided at runtime.
566+
At each argument position in an operation may be a literal {Value}, or a
567+
{Variable} to be provided at runtime.
567568

568569
CoerceArgumentValues(objectType, field, variableValues):
569570
* Let {coercedValues} be an empty unordered Map.

spec/Section 7 -- Response.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ in a response during debugging.
3838

3939
The `data` entry in the response will be the result of the execution of the
4040
requested operation. If the operation was a query, this output will be an
41-
object of the schema's query root operation type; if the operation was a mutation, this
42-
output will be an object of the schema's mutation root operation type.
41+
object of the schema's query root operation type; if the operation was a
42+
mutation, this output will be an object of the schema's mutation root
43+
operation type.
4344

4445
If an error was raised before execution begins, the `data` entry should
4546
not be present in the result.
@@ -296,8 +297,8 @@ JSON format throughout this document.
296297

297298
Since the result of evaluating a selection set is ordered, the serialized Map of
298299
results should preserve this order by writing the map entries in the same order
299-
as those fields were requested as defined by request execution. Producing a
300-
serialized response where fields are represented in the same order in which
300+
as those fields were requested as defined by selection set execution. Producing
301+
a serialized response where fields are represented in the same order in which
301302
they appear in the request improves human readability during debugging and
302303
enables more efficient parsing of responses if the order of properties can
303304
be anticipated.

0 commit comments

Comments
 (0)