Skip to content

Commit 0705a1e

Browse files
committed
chore: refresh generated API docs from source examples
Commit 106fdc9 ("docs: add prettier for jsdoc examples (#4807)") formatted source JSDoc examples on 17.x.x. No generate:docs commit followed it before fa06509: the range 106fdc9..fa06509 does not touch website/pages/api-v16, website/pages/api-v17, or website/generate-api.js. Refresh the generated v17 API output with the pinned website Prettier v2 before changing generator behavior or upgrading Prettier.
1 parent bd090a7 commit 0705a1e

6 files changed

Lines changed: 298 additions & 159 deletions

File tree

website/pages/api-v17/error.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,7 @@ import { locatedError } from 'graphql/error';
298298

299299
const document = parse('{ viewer { name } }');
300300
const fieldNode = document.definitions[0].selectionSet.selections[0];
301-
const error = locatedError(new Error('Resolver failed'), fieldNode, [
302-
'viewer',
303-
]);
301+
const error = locatedError(new Error('Resolver failed'), fieldNode, ['viewer']);
304302

305303
error.message; // => 'Resolver failed'
306304
error.locations; // => [{ line: 1, column: 3 }]

website/pages/api-v17/execution.mdx

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,10 @@ this case is the entire response.
317317
import assert from 'node:assert';
318318
import { parse } from 'graphql/language';
319319
import { buildSchema } from 'graphql/utilities';
320-
import { executeRootSelectionSet, validateExecutionArgs } from 'graphql/execution';
320+
import {
321+
executeRootSelectionSet,
322+
validateExecutionArgs,
323+
} from 'graphql/execution';
321324

322325
const schema = buildSchema('type Query { greeting: String }');
323326
const validatedArgs = validateExecutionArgs({
@@ -465,7 +468,10 @@ or rejecting the returned promise.
465468
import assert from 'node:assert';
466469
import { parse } from 'graphql/language';
467470
import { buildSchema } from 'graphql/utilities';
468-
import { executeSubscriptionEvent, validateSubscriptionArgs } from 'graphql/execution';
471+
import {
472+
executeSubscriptionEvent,
473+
validateSubscriptionArgs,
474+
} from 'graphql/execution';
469475

470476
const schema = buildSchema(`
471477
type Query {
@@ -738,7 +744,10 @@ or otherwise separating these two steps. For more on this, see the
738744
import assert from 'node:assert';
739745
import { parse } from 'graphql/language';
740746
import { buildSchema } from 'graphql/utilities';
741-
import { createSourceEventStream, validateSubscriptionArgs } from 'graphql/execution';
747+
import {
748+
createSourceEventStream,
749+
validateSubscriptionArgs,
750+
} from 'graphql/execution';
742751

743752
async function* greetings() {
744753
yield { greeting: 'Hello' };
@@ -1028,7 +1037,10 @@ stream to an ExecutionResult in the response stream.
10281037
import assert from 'node:assert';
10291038
import { parse } from 'graphql/language';
10301039
import { buildSchema } from 'graphql/utilities';
1031-
import { mapSourceToResponseEvent, validateSubscriptionArgs } from 'graphql/execution';
1040+
import {
1041+
mapSourceToResponseEvent,
1042+
validateSubscriptionArgs,
1043+
} from 'graphql/execution';
10321044

10331045
async function* events() {
10341046
yield { greeting: 'Hello' };
@@ -3770,11 +3782,9 @@ const document = parse(`
37703782
`);
37713783
const operation = document.definitions[0];
37723784

3773-
const result = getVariableValues(
3774-
schema,
3775-
operation.variableDefinitions,
3776-
{ stars: '5' },
3777-
);
3785+
const result = getVariableValues(schema, operation.variableDefinitions, {
3786+
stars: '5',
3787+
});
37783788

37793789
assert('variableValues' in result);
37803790

@@ -3938,11 +3948,9 @@ const fieldDef = schema.getQueryType().getFields().reviews;
39383948
const document = parse('query ($stars: Int!) { reviews(stars: $stars) }');
39393949
const operation = document.definitions[0];
39403950
const fieldNode = document.definitions[0].selectionSet.selections[0];
3941-
const variables = getVariableValues(
3942-
schema,
3943-
operation.variableDefinitions,
3944-
{ stars: '5' },
3945-
);
3951+
const variables = getVariableValues(schema, operation.variableDefinitions, {
3952+
stars: '5',
3953+
});
39463954

39473955
assert('variableValues' in variables);
39483956

@@ -4056,18 +4064,22 @@ import { buildSchema } from 'graphql/utilities';
40564064
import { getDirectiveValues, getVariableValues } from 'graphql/execution';
40574065

40584066
const schema = buildSchema('type Query { name: String }');
4059-
const document = parse('query ($includeName: Boolean!) { name @include(if: $includeName) }');
4067+
const document = parse(
4068+
'query ($includeName: Boolean!) { name @include(if: $includeName) }',
4069+
);
40604070
const operation = document.definitions[0];
40614071
const fieldNode = document.definitions[0].selectionSet.selections[0];
4062-
const variables = getVariableValues(
4063-
schema,
4064-
operation.variableDefinitions,
4065-
{ includeName: false },
4066-
);
4072+
const variables = getVariableValues(schema, operation.variableDefinitions, {
4073+
includeName: false,
4074+
});
40674075

40684076
assert('variableValues' in variables);
40694077

4070-
getDirectiveValues(GraphQLIncludeDirective, fieldNode, variables.variableValues); // => { if: false }
4078+
getDirectiveValues(
4079+
GraphQLIncludeDirective,
4080+
fieldNode,
4081+
variables.variableValues,
4082+
); // => { if: false }
40714083
getDirectiveValues(GraphQLIncludeDirective, { directives: [] }); // => undefined
40724084
```
40734085

website/pages/api-v17/language.mdx

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4254,18 +4254,21 @@ document.kind; // => 'Document'
42544254
// This variant enables parser options and provides an explicit lexer.
42554255
import { Lexer, Source, parse } from 'graphql/language';
42564256

4257-
const document = parse(`
4257+
const document = parse(
4258+
`
4259+
{
4260+
t { ...A(var: true) }
4261+
}
4262+
fragment A($var: Boolean = false) on T {
4263+
name
4264+
}
4265+
`,
42584266
{
4259-
t { ...A(var: true) }
4260-
}
4261-
fragment A($var: Boolean = false) on T {
4262-
name
4263-
}
4264-
`, {
4265-
experimentalFragmentArguments: true,
4266-
maxTokens: 80,
4267-
noLocation: true,
4268-
});
4267+
experimentalFragmentArguments: true,
4268+
maxTokens: 80,
4269+
noLocation: true,
4270+
},
4271+
);
42694272
const directiveDocument = parse('directive @foo @bar on FIELD', {
42704273
experimentalDirectivesOnDirectiveDefinitions: true,
42714274
});
@@ -4622,7 +4625,7 @@ This syntax is not part of the GraphQL specification and may change.</td>
46224625

46234626
<div className="api-subsection-title">experimentalFragmentArguments Example</div>
46244627

4625-
```graphql
4628+
```graphql prettier-ignore
46264629
{
46274630
t { ...A(var: true) }
46284631
}
@@ -4635,7 +4638,7 @@ fragment A($var: Boolean = false) on T {
46354638

46364639
<div className="api-subsection-title">experimentalDirectivesOnDirectiveDefinitions Example</div>
46374640

4638-
```graphql
4641+
```graphql prettier-ignore
46394642
directive @foo @bar on FIELD
46404643
```
46414644

@@ -5047,7 +5050,11 @@ Returns true when the AST node is a constant value node.
50475050
<div className="api-subsection-title">Example</div>
50485051

50495052
```ts
5050-
import { parseConstValue, parseValue, isConstValueNode } from 'graphql/language';
5053+
import {
5054+
parseConstValue,
5055+
parseValue,
5056+
isConstValueNode,
5057+
} from 'graphql/language';
50515058

50525059
const value = parseConstValue('[42]');
50535060
const variable = parseValue('$id');
@@ -5936,8 +5943,16 @@ const events = [];
59365943
visit(
59375944
document,
59385945
visitInParallel([
5939-
{ Field: (node) => { events.push(`field:${node.name.value}`); } },
5940-
{ Name: (node) => { events.push(`name:${node.value}`); } },
5946+
{
5947+
Field: (node) => {
5948+
events.push(`field:${node.name.value}`);
5949+
},
5950+
},
5951+
{
5952+
Name: (node) => {
5953+
events.push(`name:${node.value}`);
5954+
},
5955+
},
59415956
]),
59425957
);
59435958

0 commit comments

Comments
 (0)