Skip to content

Commit 8e7d2a2

Browse files
committed
Merge branch 'main' into subscription-single-root-field
2 parents c22c75d + 646f937 commit 8e7d2a2

11 files changed

+347
-199
lines changed

.github/algorithm-format-check.mjs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { readFile, readdir } from "node:fs/promises";
22

33
const SPEC_DIR = new URL("../spec", import.meta.url).pathname;
44

5+
/** @see {@link https://spec-md.com/#sec-Value-Literals} */
6+
const valueLiteralsRegexp = /\{((?:[^{}]|(?:\{[^{}]*\}))+)\}/g;
7+
58
process.exitCode = 0;
69
const filenames = await readdir(SPEC_DIR);
710
for (const filename of filenames) {
@@ -72,6 +75,33 @@ for (const filename of filenames) {
7275
console.log();
7376
process.exitCode = 1;
7477
}
78+
79+
const stepWithoutValueLiterals = step.replace(
80+
valueLiteralsRegexp,
81+
""
82+
);
83+
if (stepWithoutValueLiterals.match(/\b[A-Z][A-Za-z0-9]+\(/)) {
84+
console.log(
85+
`Bad formatting of '${algorithmName}' step (algorithm call should be wrapped in braces: \`{MyAlgorithm(a, b, c)}\`) in '${filename}':`
86+
);
87+
console.dir(step);
88+
console.log();
89+
process.exitCode = 1;
90+
}
91+
92+
const valueLiterals = step.matchAll(valueLiteralsRegexp, "");
93+
for (const lit of valueLiterals) {
94+
const inner = lit[1];
95+
if (inner.includes("{")) {
96+
console.log(
97+
`Bad formatting of '${algorithmName}' step (algorithm call should not contain braces: \`${lit}\`) in '${filename}':`
98+
);
99+
console.dir(step);
100+
console.log();
101+
process.exitCode = 1;
102+
}
103+
}
104+
75105
const trimmedInnerLine = step.replace(/\s+/g, " ");
76106
if (
77107
trimmedInnerLine.match(

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ contributions.
66

77
Contributions that do not change the interpretation of the spec but instead
88
improve legibility, fix editorial errors, clear up ambiguity and improve
9-
examples are encouraged and are often merged by a spec editor with little
10-
process.
9+
examples are encouraged. These "editorial changes" will normally be given the
10+
["✏ Editorial" label](https://github.com/graphql/graphql-spec/issues?q=sort%3Aupdated-desc+is%3Aopen+label%3A%22%E2%9C%8F%EF%B8%8F+Editorial%22)
11+
and are often merged by a spec editor with little process.
1112

1213
However, contributions that _do_ meaningfully change the interpretation of the
1314
spec must follow an RFC (Request For Comments) process led by a _champion_

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![GraphQLConf 2024 Banner: September 10-12, San Francisco. Hosted by the GraphQL Foundation](https://github.com/user-attachments/assets/0203f10b-ae1e-4fe1-9222-6547fa2bbd5d)](https://graphql.org/conf/2024/?utm_source=github&utm_medium=graphql_spec&utm_campaign=readme)
1+
[![GraphQLConf 2025 Banner: September 08-10, Amsterdam. Hosted by the GraphQL Foundation](./assets/graphql.org_conf_2025_.png)](https://graphql.org/conf/2025/?utm_source=github&utm_medium=graphql_js&utm_campaign=readme)
22

33
# GraphQL
44

STYLE_GUIDE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,25 @@ MyAlgorithm(argOne, argTwo):
8282
- Let {something} be {true}.
8383
- Return {something}.
8484
```
85+
86+
## Definitions
87+
88+
For important terms, use
89+
[Spec Markdown definition paragraphs](https://spec-md.com/#sec-Definition-Paragraph).
90+
91+
Definition paragraphs start with `::` and add the matching italicized term to
92+
the [specification index](https://spec.graphql.org/draft/#index), making it easy
93+
to reference them.
94+
95+
## Tone of voice
96+
97+
The GraphQL specification is a reference document and should use neutral and
98+
descriptive tone of voice.
99+
100+
**Favor the present tense**
101+
102+
The present tense is usually clearer and shorter:
103+
104+
✅ Present: The client then sends a request to the server.
105+
106+
❌ Future: The client will then send a request to the server.

assets/graphql.org_conf_2025_.png

488 KB
Loading

spec/Section 2 -- Language.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,9 @@ These two operations are semantically identical:
466466

467467
Alias : Name :
468468

469-
By default a field's response key in the response object will use that field's
470-
name. However, you can define a different response key by specifying an alias.
469+
:: A _response name_ is the key in the response object which correlates with a
470+
field's result. By default the response name will use the field's name; however,
471+
you can define a different response name by specifying an alias.
471472

472473
In this example, we can fetch two profile pictures of different sizes and ensure
473474
the resulting response object will not have duplicate keys:
@@ -1253,7 +1254,7 @@ Type : Name
12531254

12541255
- Let {name} be the string value of {Name}.
12551256
- Let {type} be the type defined in the Schema named {name}.
1256-
- {type} must not be {null}.
1257+
- {type} must exist.
12571258
- Return {type}.
12581259

12591260
Type : [ Type ]

spec/Section 3 -- Type System.md

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ A GraphQL schema may describe that a field represents a list of another type;
329329
the `List` type is provided for this reason, and wraps another type.
330330

331331
Similarly, the `Non-Null` type wraps another type, and denotes that the
332-
resulting value will never be {null} (and that a _field error_ cannot result in
333-
a {null} value).
332+
resulting value will never be {null} (and that an _execution error_ cannot
333+
result in a {null} value).
334334

335335
These two types are referred to as "wrapping types"; non-wrapping types are
336336
referred to as "named types". A wrapping type has an underlying named type,
@@ -351,7 +351,7 @@ IsInputType(type):
351351

352352
- If {type} is a List type or Non-Null type:
353353
- Let {unwrappedType} be the unwrapped type of {type}.
354-
- Return IsInputType({unwrappedType}).
354+
- Return {IsInputType(unwrappedType)}.
355355
- If {type} is a Scalar, Enum, or Input Object type:
356356
- Return {true}.
357357
- Return {false}.
@@ -360,7 +360,7 @@ IsOutputType(type):
360360

361361
- If {type} is a List type or Non-Null type:
362362
- Let {unwrappedType} be the unwrapped type of {type}.
363-
- Return IsOutputType({unwrappedType}).
363+
- Return {IsOutputType(unwrappedType)}.
364364
- If {type} is a Scalar, Object, Interface, Union, or Enum type:
365365
- Return {true}.
366366
- Return {false}.
@@ -461,14 +461,14 @@ more guidance.
461461

462462
A GraphQL service, when preparing a field of a given scalar type, must uphold
463463
the contract the scalar type describes, either by coercing the value or
464-
producing a _field error_ if a value cannot be coerced or if coercion may result
465-
in data loss.
464+
producing an _execution error_ if a value cannot be coerced or if coercion may
465+
result in data loss.
466466

467467
A GraphQL service may decide to allow coercing different internal types to the
468468
expected return type. For example when coercing a field of type {Int} a boolean
469469
{true} value may produce {1} or a string value {"123"} may be parsed as base-10
470470
{123}. However if internal type coercion cannot be reasonably performed without
471-
losing information, then it must raise a _field error_.
471+
losing information, then it must raise an _execution error_.
472472

473473
Since this coercion behavior is not observable to clients of the GraphQL
474474
service, the precise rules of coercion are left to the implementation. The only
@@ -513,15 +513,15 @@ Fields returning the type {Int} expect to encounter 32-bit integer internal
513513
values.
514514

515515
GraphQL services may coerce non-integer internal values to integers when
516-
reasonable without losing information, otherwise they must raise a _field
516+
reasonable without losing information, otherwise they must raise an _execution
517517
error_. Examples of this may include returning `1` for the floating-point number
518518
`1.0`, or returning `123` for the string `"123"`. In scenarios where coercion
519-
may lose data, raising a field error is more appropriate. For example, a
520-
floating-point number `1.2` should raise a field error instead of being
519+
may lose data, raising an execution error is more appropriate. For example, a
520+
floating-point number `1.2` should raise an execution error instead of being
521521
truncated to `1`.
522522

523523
If the integer internal value represents a value less than -2<sup>31</sup> or
524-
greater than or equal to 2<sup>31</sup>, a _field error_ should be raised.
524+
greater than or equal to 2<sup>31</sup>, an _execution error_ should be raised.
525525

526526
**Input Coercion**
527527

@@ -548,12 +548,12 @@ Fields returning the type {Float} expect to encounter double-precision
548548
floating-point internal values.
549549

550550
GraphQL services may coerce non-floating-point internal values to {Float} when
551-
reasonable without losing information, otherwise they must raise a _field
551+
reasonable without losing information, otherwise they must raise an _execution
552552
error_. Examples of this may include returning `1.0` for the integer number `1`,
553553
or `123.0` for the string `"123"`.
554554

555555
Non-finite floating-point internal values ({NaN} and {Infinity}) cannot be
556-
coerced to {Float} and must raise a _field error_.
556+
coerced to {Float} and must raise an _execution error_.
557557

558558
**Input Coercion**
559559

@@ -579,9 +579,9 @@ that representation must be used to serialize this type.
579579
Fields returning the type {String} expect to encounter Unicode string values.
580580

581581
GraphQL services may coerce non-string raw values to {String} when reasonable
582-
without losing information, otherwise they must raise a _field error_. Examples
583-
of this may include returning the string `"true"` for a boolean true value, or
584-
the string `"1"` for the integer `1`.
582+
without losing information, otherwise they must raise an _execution error_.
583+
Examples of this may include returning the string `"true"` for a boolean true
584+
value, or the string `"1"` for the integer `1`.
585585

586586
**Input Coercion**
587587

@@ -600,8 +600,8 @@ representation of the integers `1` and `0`.
600600
Fields returning the type {Boolean} expect to encounter boolean internal values.
601601

602602
GraphQL services may coerce non-boolean raw values to {Boolean} when reasonable
603-
without losing information, otherwise they must raise a _field error_. Examples
604-
of this may include returning `true` for non-zero numbers.
603+
without losing information, otherwise they must raise an _execution error_.
604+
Examples of this may include returning `true` for non-zero numbers.
605605

606606
**Input Coercion**
607607

@@ -623,7 +623,7 @@ large 128-bit random numbers, to base64 encoded values, or string values of a
623623
format like [GUID](https://en.wikipedia.org/wiki/Globally_unique_identifier).
624624

625625
GraphQL services should coerce as appropriate given the ID formats they expect.
626-
When coercion is not possible they must raise a _field error_.
626+
When coercion is not possible they must raise an _execution error_.
627627

628628
**Input Coercion**
629629

@@ -947,6 +947,7 @@ IsValidImplementation(type, implementedType):
947947
2. Let {implementedFieldType} be the return type of {implementedField}.
948948
3. {IsValidImplementationFieldType(fieldType, implementedFieldType)} must
949949
be {true}.
950+
6. If {field} is deprecated then {implementedField} must also be deprecated.
950951

951952
IsValidImplementationFieldType(fieldType, implementedFieldType):
952953

@@ -1492,7 +1493,7 @@ enum Direction {
14921493
**Result Coercion**
14931494

14941495
GraphQL services must return one of the defined set of possible values. If a
1495-
reasonable coercion is not possible they must raise a _field error_.
1496+
reasonable coercion is not possible they must raise an _execution error_.
14961497

14971498
**Input Coercion**
14981499

@@ -1548,8 +1549,9 @@ Fields may accept arguments to configure their behavior. These inputs are often
15481549
scalars or enums, but they sometimes need to represent more complex values.
15491550

15501551
A GraphQL Input Object defines a set of input fields; the input fields are
1551-
either scalars, enums, or other input objects. This allows arguments to accept
1552-
arbitrarily complex structs.
1552+
scalars, enums, other input objects, or any wrapping type whose underlying base
1553+
type is one of those three. This allows arguments to accept arbitrarily complex
1554+
structs.
15531555

15541556
In this example, an Input Object called `Point2D` describes `x` and `y` inputs:
15551557

@@ -1654,10 +1656,10 @@ is constructed with the following rules:
16541656

16551657
- If a variable is provided for an input object field, the runtime value of that
16561658
variable must be used. If the runtime value is {null} and the field type is
1657-
non-null, a _field error_ must be raised. If no runtime value is provided, the
1658-
variable definition's default value should be used. If the variable definition
1659-
does not provide a default value, the input object field definition's default
1660-
value should be used.
1659+
non-null, an _execution error_ must be raised. If no runtime value is
1660+
provided, the variable definition's default value should be used. If the
1661+
variable definition does not provide a default value, the input object field
1662+
definition's default value should be used.
16611663

16621664
Following are examples of input coercion for an input object type with a
16631665
`String` field `a` and a required (non-null) `Int!` field `b`:
@@ -1742,19 +1744,19 @@ brackets like this: `pets: [Pet]`. Nesting lists is allowed: `matrix: [[Int]]`.
17421744

17431745
GraphQL services must return an ordered list as the result of a list type. Each
17441746
item in the list must be the result of a result coercion of the item type. If a
1745-
reasonable coercion is not possible it must raise a _field error_. In
1747+
reasonable coercion is not possible it must raise an _execution error_. In
17461748
particular, if a non-list is returned, the coercion should fail, as this
17471749
indicates a mismatch in expectations between the type system and the
17481750
implementation.
17491751

17501752
If a list's item type is nullable, then errors occurring during preparation or
17511753
coercion of an individual item in the list must result in a the value {null} at
1752-
that position in the list along with a _field error_ added to the response. If a
1753-
list's item type is non-null, a field error occurring at an individual item in
1754-
the list must result in a field error for the entire list.
1754+
that position in the list along with an _execution error_ added to the response.
1755+
If a list's item type is non-null, an execution error occurring at an individual
1756+
item in the list must result in an execution error for the entire list.
17551757

1756-
Note: See [Handling Field Errors](#sec-Handling-Field-Errors) for more about
1757-
this behavior.
1758+
Note: See [Handling Execution Errors](#sec-Handling-Execution-Errors) for more
1759+
about this behavior.
17581760

17591761
**Input Coercion**
17601762

@@ -1812,12 +1814,13 @@ always optional and non-null types are always required.
18121814
In all of the above result coercions, {null} was considered a valid value. To
18131815
coerce the result of a Non-Null type, the coercion of the wrapped type should be
18141816
performed. If that result was not {null}, then the result of coercing the
1815-
Non-Null type is that result. If that result was {null}, then a _field error_
1816-
must be raised.
1817+
Non-Null type is that result. If that result was {null}, then an _execution
1818+
error_ must be raised.
18171819

1818-
Note: When a _field error_ is raised on a non-null value, the error propagates
1819-
to the parent field. For more information on this process, see
1820-
[Errors and Non-Null Fields](#sec-Executing-Selection-Sets.Errors-and-Non-Null-Fields)
1820+
Note: When an _execution error_ is raised on a non-null _response position_, the
1821+
error propagates to the parent _response position_. For more information on this
1822+
process, see
1823+
[Errors and Non-Null Types](#sec-Executing-Selection-Sets.Errors-and-Non-Null-Types)
18211824
within the Execution section.
18221825

18231826
**Input Coercion**
@@ -2035,19 +2038,20 @@ directive @invalidExample(arg: String @invalidExample) on ARGUMENT_DEFINITION
20352038
Note: The order in which directives appear may be significant, including
20362039
repeatable directives.
20372040

2038-
**Validation**
2041+
**Type Validation**
20392042

2040-
1. A directive definition must not contain the use of a directive which
2043+
1. A Directive definition must include at least one DirectiveLocation.
2044+
2. A Directive definition must not contain the use of a Directive which
20412045
references itself directly.
2042-
2. A directive definition must not contain the use of a directive which
2046+
3. A Directive definition must not contain the use of a Directive which
20432047
references itself indirectly by referencing a Type or Directive which
2044-
transitively includes a reference to this directive.
2045-
3. The directive must not have a name which begins with the characters {"\_\_"}
2048+
transitively includes a reference to this Directive.
2049+
4. The Directive must not have a name which begins with the characters {"\_\_"}
20462050
(two underscores).
2047-
4. For each argument of the directive:
2051+
5. For each argument of the Directive:
20482052
1. The argument must not have a name which begins with the characters
20492053
{"\_\_"} (two underscores).
2050-
2. The argument must have a unique name within that directive; no two
2054+
2. The argument must have a unique name within that Directive; no two
20512055
arguments may share the same name.
20522056
3. The argument must accept a type where {IsInputType(argumentType)} returns
20532057
{true}.

spec/Section 4 -- Introspection.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ type __Type {
138138
name: String
139139
description: String
140140
# must be non-null for OBJECT and INTERFACE, otherwise null.
141-
fields(includeDeprecated: Boolean = false): [__Field!]
141+
fields(includeDeprecated: Boolean! = false): [__Field!]
142142
# must be non-null for OBJECT and INTERFACE, otherwise null.
143143
interfaces: [__Type!]
144144
# must be non-null for INTERFACE and UNION, otherwise null.
145145
possibleTypes: [__Type!]
146146
# must be non-null for ENUM, otherwise null.
147-
enumValues(includeDeprecated: Boolean = false): [__EnumValue!]
147+
enumValues(includeDeprecated: Boolean! = false): [__EnumValue!]
148148
# must be non-null for INPUT_OBJECT, otherwise null.
149-
inputFields(includeDeprecated: Boolean = false): [__InputValue!]
149+
inputFields(includeDeprecated: Boolean! = false): [__InputValue!]
150150
# must be non-null for NON_NULL and LIST, otherwise null.
151151
ofType: __Type
152152
# may be non-null for custom SCALAR, otherwise null.
@@ -167,7 +167,7 @@ enum __TypeKind {
167167
type __Field {
168168
name: String!
169169
description: String
170-
args(includeDeprecated: Boolean = false): [__InputValue!]!
170+
args(includeDeprecated: Boolean! = false): [__InputValue!]!
171171
type: __Type!
172172
isDeprecated: Boolean!
173173
deprecationReason: String
@@ -193,7 +193,7 @@ type __Directive {
193193
name: String!
194194
description: String
195195
locations: [__DirectiveLocation!]!
196-
args(includeDeprecated: Boolean = false): [__InputValue!]!
196+
args(includeDeprecated: Boolean! = false): [__InputValue!]!
197197
isRepeatable: Boolean!
198198
}
199199

0 commit comments

Comments
 (0)