UNPKG

1.45 kBTypeScriptView Raw
1import { DocumentNode } from '../language/ast';
2import { GraphQLSchemaValidationOptions, GraphQLSchema } from '../type/schema';
3
4interface Options extends GraphQLSchemaValidationOptions {
5 /**
6 * Descriptions are defined as preceding string literals, however an older
7 * experimental version of the SDL supported preceding comments as
8 * descriptions. Set to true to enable this deprecated behavior.
9 * This option is provided to ease adoption and will be removed in v16.
10 *
11 * Default: false
12 */
13 commentDescriptions?: boolean;
14
15 /**
16 * Set to true to assume the SDL is valid.
17 *
18 * Default: false
19 */
20 assumeValidSDL?: boolean;
21}
22
23/**
24 * Produces a new schema given an existing schema and a document which may
25 * contain GraphQL type extensions and definitions. The original schema will
26 * remain unaltered.
27 *
28 * Because a schema represents a graph of references, a schema cannot be
29 * extended without effectively making an entire copy. We do not know until it's
30 * too late if subgraphs remain unchanged.
31 *
32 * This algorithm copies the provided schema, applying extensions while
33 * producing the copy. The original schema remains unaltered.
34 *
35 * Accepts options as a third argument:
36 *
37 * - commentDescriptions:
38 * Provide true to use preceding comments as the description.
39 *
40 */
41export function extendSchema(
42 schema: GraphQLSchema,
43 documentAST: DocumentNode,
44 options?: Options,
45): GraphQLSchema;