Skip to content

Commit 6a7271b

Browse files
committed
Merge branch 'main' into before-execution-begins-note
2 parents 0e175cb + 4abd86e commit 6a7271b

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
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(

spec/Section 3 -- Type System.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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}.

spec/Section 6 -- Execution.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,7 @@ type need to be known, as well as whether it must be executed serially, or may
355355
be executed in parallel.
356356

357357
First, the selection set is turned into a grouped field set; then, each
358-
represented field in the grouped field set produces an entry into a response
359-
map.
358+
represented field in the grouped field set produces an entry into a result map.
360359

361360
ExecuteSelectionSet(selectionSet, objectType, objectValue, variableValues):
362361

@@ -596,7 +595,7 @@ directives may be applied in either order since they apply commutatively.
596595
## Executing Fields
597596

598597
Each field requested in the grouped field set that is defined on the selected
599-
objectType will result in an entry in the response map. Field execution first
598+
objectType will result in an entry in the result map. Field execution first
600599
coerces any provided argument values, then resolves a value for the field, and
601600
finally completes that value either by recursively executing another selection
602601
set or coercing a scalar value.

0 commit comments

Comments
 (0)