@@ -94,18 +94,28 @@ export type RootSelectionSetExecutor = (
9494 * import { buildSchema } from 'graphql/utilities';
9595 * import { execute } from 'graphql/execution';
9696 *
97- * const schema = buildSchema(`
98- * type Query {
99- * greeting(name: String!): String
100- * }
101- * `);
97+ * const schema = buildSchema(
98+ * `
99+ * type Query {
100+ * greeting(name: String!): String
101+ * }
102+ * `,
103+ * {
104+ * supplementalConfig: {
105+ * objectTypes: {
106+ * Query: {
107+ * fields: {
108+ * greeting: (_source, { name }) => `Hello, ${name}!`,
109+ * },
110+ * },
111+ * },
112+ * },
113+ * },
114+ * );
102115 *
103116 * const result = await execute({
104117 * schema,
105118 * document: parse('query ($name: String!) { greeting(name: $name) }'),
106- * rootValue: {
107- * greeting: ({ name }) => `Hello, ${name}!`,
108- * },
109119 * variableValues: { name: 'Ada' },
110120 * });
111121 *
@@ -185,16 +195,28 @@ function executeImpl(args: ExecutionArgs): PromiseOrValue<ExecutionResult> {
185195 * import { buildSchema } from 'graphql/utilities';
186196 * import { experimentalExecuteIncrementally } from 'graphql/execution';
187197 *
188- * const schema = buildSchema(`
189- * type Query {
190- * greeting: String
191- * }
192- * `);
198+ * const schema = buildSchema(
199+ * `
200+ * type Query {
201+ * greeting: String
202+ * }
203+ * `,
204+ * {
205+ * supplementalConfig: {
206+ * objectTypes: {
207+ * Query: {
208+ * fields: {
209+ * greeting: () => 'Hello',
210+ * },
211+ * },
212+ * },
213+ * },
214+ * },
215+ * );
193216 *
194217 * const result = await experimentalExecuteIncrementally({
195218 * schema,
196219 * document: parse('{ greeting }'),
197- * rootValue: { greeting: 'Hello' },
198220 * });
199221 *
200222 * result; // => { data: { greeting: 'Hello' } }
@@ -455,7 +477,6 @@ export function executeSubscriptionEvent(
455477 * @returns A response stream for a valid subscription, or an execution result containing errors.
456478 * @example
457479 * ```ts
458- * // Use a same-named rootValue function to provide the source event stream.
459480 * import assert from 'node:assert';
460481 * import { parse } from 'graphql/language';
461482 * import { buildSchema } from 'graphql/utilities';
@@ -466,20 +487,34 @@ export function executeSubscriptionEvent(
466487 * yield { greeting: 'Bonjour' };
467488 * }
468489 *
469- * const schema = buildSchema(`
470- * type Query {
471- * noop: String
472- * }
473- *
474- * type Subscription {
475- * greeting: String
476- * }
477- * `);
490+ * const schema = buildSchema(
491+ * `
492+ * type Query {
493+ * noop: String
494+ * }
495+ *
496+ * type Subscription {
497+ * greeting: String
498+ * }
499+ * `,
500+ * {
501+ * supplementalConfig: {
502+ * objectTypes: {
503+ * Subscription: {
504+ * fields: {
505+ * greeting: {
506+ * subscribe: () => greetings(),
507+ * },
508+ * },
509+ * },
510+ * },
511+ * },
512+ * },
513+ * );
478514 *
479515 * const result = await subscribe({
480516 * schema,
481517 * document: parse('subscription { greeting }'),
482- * rootValue: { greeting: () => greetings() },
483518 * });
484519 *
485520 * assert('next' in result);
@@ -627,19 +662,33 @@ function subscribeImpl(
627662 * yield { greeting: 'Hello' };
628663 * }
629664 *
630- * const schema = buildSchema(`
631- * type Query {
632- * noop: String
633- * }
634- *
635- * type Subscription {
636- * greeting: String
637- * }
638- * `);
665+ * const schema = buildSchema(
666+ * `
667+ * type Query {
668+ * noop: String
669+ * }
670+ *
671+ * type Subscription {
672+ * greeting: String
673+ * }
674+ * `,
675+ * {
676+ * supplementalConfig: {
677+ * objectTypes: {
678+ * Subscription: {
679+ * fields: {
680+ * greeting: {
681+ * subscribe: () => greetings(),
682+ * },
683+ * },
684+ * },
685+ * },
686+ * },
687+ * },
688+ * );
639689 * const validatedArgs = validateSubscriptionArgs({
640690 * schema,
641691 * document: parse('subscription { greeting }'),
642- * rootValue: { greeting: () => greetings() },
643692 * });
644693 *
645694 * assert('schema' in validatedArgs);
0 commit comments