1 | import { Maybe } from '../jsutils/Maybe';
|
2 |
|
3 | import { Location, DocumentNode, StringValueNode } from '../language/ast';
|
4 | import {
|
5 | GraphQLSchemaValidationOptions,
|
6 | GraphQLSchema,
|
7 | GraphQLSchemaNormalizedConfig,
|
8 | } from '../type/schema';
|
9 |
|
10 | interface Options extends GraphQLSchemaValidationOptions {
|
11 | /**
|
12 | * Descriptions are defined as preceding string literals, however an older
|
13 | * experimental version of the SDL supported preceding comments as
|
14 | * descriptions. Set to true to enable this deprecated behavior.
|
15 | * This option is provided to ease adoption and will be removed in v16.
|
16 | *
|
17 | * Default: false
|
18 | */
|
19 | commentDescriptions?: boolean;
|
20 |
|
21 | /**
|
22 | * Set to true to assume the SDL is valid.
|
23 | *
|
24 | * Default: false
|
25 | */
|
26 | assumeValidSDL?: boolean;
|
27 | }
|
28 |
|
29 | /**
|
30 | * Produces a new schema given an existing schema and a document which may
|
31 | * contain GraphQL type extensions and definitions. The original schema will
|
32 | * remain unaltered.
|
33 | *
|
34 | * Because a schema represents a graph of references, a schema cannot be
|
35 | * extended without effectively making an entire copy. We do not know until it's
|
36 | * too late if subgraphs remain unchanged.
|
37 | *
|
38 | * This algorithm copies the provided schema, applying extensions while
|
39 | * producing the copy. The original schema remains unaltered.
|
40 | *
|
41 | * Accepts options as a third argument:
|
42 | *
|
43 | * - commentDescriptions:
|
44 | * Provide true to use preceding comments as the description.
|
45 | *
|
46 | */
|
47 | export function extendSchema(
|
48 | schema: GraphQLSchema,
|
49 | documentAST: DocumentNode,
|
50 | options?: Options,
|
51 | ): GraphQLSchema;
|
52 |
|
53 | /**
|
54 | * @internal
|
55 | */
|
56 | export function extendSchemaImpl(
|
57 | schemaConfig: GraphQLSchemaNormalizedConfig,
|
58 | documentAST: DocumentNode,
|
59 | options?: Options,
|
60 | ): GraphQLSchemaNormalizedConfig;
|
61 |
|
62 | /**
|
63 | * Given an ast node, returns its string description.
|
64 | * @deprecated: provided to ease adoption and will be removed in v16.
|
65 | *
|
66 | * Accepts options as a second argument:
|
67 | *
|
68 | * - commentDescriptions:
|
69 | * Provide true to use preceding comments as the description.
|
70 | *
|
71 | */
|
72 | export function getDescription(
|
73 | node: { readonly description?: StringValueNode; readonly loc?: Location },
|
74 | options?: Maybe<{ commentDescriptions?: boolean }>,
|
75 | ): string | undefined;
|