Skip to content

Commit c6f3035

Browse files
authored
Merge branch 'main' into deduplicate5
2 parents b8e5187 + e546aac commit c6f3035

6 files changed

+104
-28
lines changed

Diff for: .github/algorithm-format-check.mjs

+68-5
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ for (const filename of filenames) {
2323
{
2424
// Is it an algorithm definition?
2525
const matches = line.match(/^([a-z0-9A-Z]+)(\s*)\(([^)]*)\)(\s*):(\s*)$/);
26+
const grammarMatches =
27+
filename === "Section 2 -- Language.md" &&
28+
line.match(/^([A-Za-z0-9]+) :\s+((\S).*)$/);
2629
if (matches) {
2730
const [, algorithmName, ns1, _args, ns2, ns3] = matches;
2831
if (ns1 || ns2 || ns3) {
2932
console.log(
3033
`Bad whitespace in definition of ${algorithmName} in '${filename}':`
3134
);
32-
console.log(line);
35+
console.dir(line);
3336
console.log();
3437
process.exitCode = 1;
3538
}
@@ -47,7 +50,7 @@ for (const filename of filenames) {
4750
console.log(
4851
`Bad algorithm ${algorithmName} step in '${filename}':`
4952
);
50-
console.log(step);
53+
console.dir(step);
5154
console.log();
5255
process.exitCode = 1;
5356
}
@@ -57,15 +60,15 @@ for (const filename of filenames) {
5760
console.log(
5861
`Bad formatting for '${algorithmName}' step (does not end in '.' or ':') in '${filename}':`
5962
);
60-
console.log(step);
63+
console.dir(step);
6164
console.log();
6265
process.exitCode = 1;
6366
}
6467
if (step.match(/^\s*(-|[0-9]\.)\s+[a-z]/)) {
6568
console.log(
6669
`Bad formatting of '${algorithmName}' step (should start with a capital) in '${filename}':`
6770
);
68-
console.log(step);
71+
console.dir(step);
6972
console.log();
7073
process.exitCode = 1;
7174
}
@@ -79,7 +82,67 @@ for (const filename of filenames) {
7982
console.log(
8083
`Potential bad formatting of '${algorithmName}' step (true/false/null should be wrapped in curly braces, e.g. '{true}') in '${filename}':`
8184
);
82-
console.log(step);
85+
console.dir(step);
86+
console.log();
87+
process.exitCode = 1;
88+
}
89+
}
90+
} else if (grammarMatches) {
91+
// This is super loosey-goosey
92+
const [, grammarName, rest] = grammarMatches;
93+
if (rest.trim() === "one of") {
94+
// Still grammar, not algorithm
95+
continue;
96+
}
97+
if (rest.trim() === "" && lines[i + 1] !== "") {
98+
console.log(
99+
`No empty space after grammar ${grammarName} header in '${filename}'`
100+
);
101+
console.log();
102+
process.exitCode = 1;
103+
}
104+
if (!lines[i + 2].startsWith("- ")) {
105+
// Not an algorithm; probably more grammar
106+
continue;
107+
}
108+
for (let j = i + 2; j < l; j++) {
109+
const step = lines[j];
110+
if (!step.match(/^\s*(-|[0-9]+\.) /)) {
111+
if (step !== "") {
112+
console.log(`Bad grammar ${grammarName} step in '${filename}':`);
113+
console.dir(step);
114+
console.log();
115+
process.exitCode = 1;
116+
}
117+
break;
118+
}
119+
if (!step.match(/[.:]$/)) {
120+
console.log(
121+
`Bad formatting for '${grammarName}' step (does not end in '.' or ':') in '${filename}':`
122+
);
123+
console.dir(step);
124+
console.log();
125+
process.exitCode = 1;
126+
}
127+
if (step.match(/^\s*(-|[0-9]\.)\s+[a-z]/)) {
128+
console.log(
129+
`Bad formatting of '${grammarName}' step (should start with a capital) in '${filename}':`
130+
);
131+
console.dir(step);
132+
console.log();
133+
process.exitCode = 1;
134+
}
135+
const trimmedInnerLine = step.replace(/\s+/g, " ");
136+
if (
137+
trimmedInnerLine.match(
138+
/(?:[rR]eturn|is (?:not )?)(true|false|null)\b/
139+
) &&
140+
!trimmedInnerLine.match(/null or empty/)
141+
) {
142+
console.log(
143+
`Potential bad formatting of '${grammarName}' step (true/false/null should be wrapped in curly braces, e.g. '{true}') in '${filename}':`
144+
);
145+
console.dir(step);
83146
console.log();
84147
process.exitCode = 1;
85148
}

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
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)
2+
13
# GraphQL
24

35
<img alt="GraphQL Logo" align="right" src="https://graphql.org/img/logo.svg" width="15%" />

Diff for: cspell.yml

+4
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ words:
2121
- tatooine
2222
- zuck
2323
- zuckerberg
24+
# Forbid Alternative spellings
25+
flagWords:
26+
- implementor
27+
- implementors

Diff for: spec/Section 5 -- Validation.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ fragment aliasedLyingFieldTargetNotDefined on Dog {
362362
```
363363

364364
For interfaces, direct field selection can only be done on fields. Fields of
365-
concrete implementors are not relevant to the validity of the given
365+
concrete implementers are not relevant to the validity of the given
366366
interface-typed selection set.
367367

368368
For example, the following is valid:
@@ -376,7 +376,7 @@ fragment interfaceFieldSelection on Pet {
376376
and the following is invalid:
377377

378378
```graphql counter-example
379-
fragment definedOnImplementorsButNotInterface on Pet {
379+
fragment definedOnImplementersButNotInterface on Pet {
380380
nickname
381381
}
382382
```
@@ -446,7 +446,8 @@ SameResponseShape(fieldA, fieldB):
446446
- If {typeA} or {typeB} is Scalar or Enum:
447447
- If {typeA} and {typeB} are the same type return {true}, otherwise return
448448
{false}.
449-
- Assert: {typeA} and {typeB} are both composite types.
449+
- Assert: {typeA} is an object, union or interface type.
450+
- Assert: {typeB} is an object, union or interface type.
450451
- Let {mergedSet} be the result of adding the selection set of {fieldA} and the
451452
selection set of {fieldB}.
452453
- Let {fieldsForName} be the set of selections with a given response name in
@@ -455,6 +456,9 @@ SameResponseShape(fieldA, fieldB):
455456
- If {SameResponseShape(subfieldA, subfieldB)} is {false}, return {false}.
456457
- Return {true}.
457458

459+
Note: In prior versions of the spec the term "composite" was used to signal a
460+
type that is either an Object, Interface or Union type.
461+
458462
**Explanatory Text**
459463

460464
If multiple field selections with the same response names are encountered during
@@ -910,7 +914,7 @@ fragment inlineNotExistingType on Dog {
910914
}
911915
```
912916

913-
#### Fragments on Composite Types
917+
#### Fragments on Object, Interface or Union Types
914918

915919
**Formal Specification**
916920

Diff for: spec/Section 6 -- Execution.md

+20-17
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@ A GraphQL service generates a response from a request via execution.
44

55
:: A _request_ for execution consists of a few pieces of information:
66

7-
- The schema to use, typically solely provided by the GraphQL service.
8-
- A {Document} which must contain GraphQL {OperationDefinition} and may contain
9-
{FragmentDefinition}.
10-
- Optionally: The name of the Operation in the Document to execute.
11-
- Optionally: Values for any Variables defined by the Operation.
12-
- An initial value corresponding to the root type being executed. Conceptually,
13-
an initial value represents the "universe" of data available via a GraphQL
14-
Service. It is common for a GraphQL Service to always use the same initial
15-
value for every request.
16-
17-
Given this information, the result of {ExecuteRequest()} produces the response,
18-
to be formatted according to the Response section below.
7+
- {schema}: The schema to use, typically solely provided by the GraphQL service.
8+
- {document}: A {Document} which must contain GraphQL {OperationDefinition} and
9+
may contain {FragmentDefinition}.
10+
- {operationName} (optional): The name of the Operation in the Document to
11+
execute.
12+
- {variableValues} (optional): Values for any Variables defined by the
13+
Operation.
14+
- {initialValue} (optional): An initial value corresponding to the root type
15+
being executed. Conceptually, an initial value represents the "universe" of
16+
data available via a GraphQL Service. It is common for a GraphQL Service to
17+
always use the same initial value for every request.
18+
19+
Given this information, the result of {ExecuteRequest(schema, document,
20+
operationName, variableValues, initialValue)} produces the response, to be
21+
formatted according to the Response section below.
1922

2023
Note: GraphQL requests do not require any specific serialization format or
2124
transport mechanism. Message serialization and transport mechanisms should be
@@ -284,11 +287,11 @@ subscription _selection set_ using that event as a root value.
284287
MapSourceToResponseEvent(sourceStream, subscription, schema, variableValues):
285288

286289
- Return a new event stream {responseStream} which yields events as follows:
287-
- For each {event} on {sourceStream}:
288-
- Let {response} be the result of running
289-
{ExecuteSubscriptionEvent(subscription, schema, variableValues, event)}.
290-
- Yield an event containing {response}.
291-
- When {responseStream} completes: complete this event stream.
290+
- For each {event} on {sourceStream}:
291+
- Let {response} be the result of running
292+
{ExecuteSubscriptionEvent(subscription, schema, variableValues, event)}.
293+
- Yield an event containing {response}.
294+
- When {sourceStream} completes: complete {responseStream}.
292295

293296
ExecuteSubscriptionEvent(subscription, schema, variableValues, initialValue):
294297

Diff for: spec/Section 7 -- Response.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ request failed before execution, due to a syntax error, missing information, or
2323
validation error, this entry must not be present.
2424

2525
The response map may also contain an entry with key `extensions`. This entry, if
26-
set, must have a map as its value. This entry is reserved for implementors to
26+
set, must have a map as its value. This entry is reserved for implementers to
2727
extend the protocol however they see fit, and hence there are no additional
2828
restrictions on its contents.
2929

@@ -203,7 +203,7 @@ be the same:
203203

204204
GraphQL services may provide an additional entry to errors with key
205205
`extensions`. This entry, if set, must have a map as its value. This entry is
206-
reserved for implementors to add additional information to errors however they
206+
reserved for implementers to add additional information to errors however they
207207
see fit, and there are no additional restrictions on its contents.
208208

209209
```json example

0 commit comments

Comments
 (0)