UNPKG

1.17 kBTypeScriptView Raw
1import type { DocumentNode } from '../language/ast';
2import type { ParseOptions } from '../language/parser';
3import type { Source } from '../language/source';
4import type { GraphQLSchemaValidationOptions } from '../type/schema';
5import { GraphQLSchema } from '../type/schema';
6export interface BuildSchemaOptions extends GraphQLSchemaValidationOptions {
7 /**
8 * Set to true to assume the SDL is valid.
9 *
10 * Default: false
11 */
12 assumeValidSDL?: boolean;
13}
14/**
15 * This takes the ast of a schema document produced by the parse function in
16 * src/language/parser.js.
17 *
18 * If no schema definition is provided, then it will look for types named Query,
19 * Mutation and Subscription.
20 *
21 * Given that AST it constructs a GraphQLSchema. The resulting schema
22 * has no resolve methods, so execution will use default resolvers.
23 */
24export declare function buildASTSchema(
25 documentAST: DocumentNode,
26 options?: BuildSchemaOptions,
27): GraphQLSchema;
28/**
29 * A helper function to build a GraphQLSchema directly from a source
30 * document.
31 */
32export declare function buildSchema(
33 source: string | Source,
34 options?: BuildSchemaOptions & ParseOptions,
35): GraphQLSchema;