1 | import { IExecutableSchemaDefinition } from './types';
|
2 | /**
|
3 | * Builds a schema from the provided type definitions and resolvers.
|
4 | *
|
5 | * The type definitions are written using Schema Definition Language (SDL). They
|
6 | * can be provided as a string, a `DocumentNode`, a function, or an array of any
|
7 | * of these. If a function is provided, it will be passed no arguments and
|
8 | * should return an array of strings or `DocumentNode`s.
|
9 | *
|
10 | * Note: You can use `graphql-tag` to not only parse a string into a
|
11 | * `DocumentNode` but also to provide additional syntax highlighting in your
|
12 | * editor (with the appropriate editor plugin).
|
13 | *
|
14 | * ```js
|
15 | * const typeDefs = gql`
|
16 | * type Query {
|
17 | * posts: [Post]
|
18 | * author(id: Int!): Author
|
19 | * }
|
20 | * `;
|
21 | * ```
|
22 | *
|
23 | * The `resolvers` object should be a map of type names to nested object, which
|
24 | * themselves map the type's fields to their appropriate resolvers.
|
25 | * See the [Resolvers](/docs/resolvers) section of the documentation for more details.
|
26 | *
|
27 | * ```js
|
28 | * const resolvers = {
|
29 | * Query: {
|
30 | * posts: (obj, args, ctx, info) => getAllPosts(),
|
31 | * author: (obj, args, ctx, info) => getAuthorById(args.id)
|
32 | * }
|
33 | * };
|
34 | * ```
|
35 | *
|
36 | * Once you've defined both the `typeDefs` and `resolvers`, you can create your
|
37 | * schema:
|
38 | *
|
39 | * ```js
|
40 | * const schema = makeExecutableSchema({
|
41 | * typeDefs,
|
42 | * resolvers,
|
43 | * })
|
44 | * ```
|
45 | */
|
46 | export declare function makeExecutableSchema<TContext = any>({ typeDefs, resolvers, logger, allowUndefinedInResolve, resolverValidationOptions, directiveResolvers, schemaDirectives, schemaTransforms: userProvidedSchemaTransforms, parseOptions, inheritResolversFromInterfaces, pruningOptions, updateResolversInPlace, noExtensionExtraction, }: IExecutableSchemaDefinition<TContext>): import("graphql").GraphQLSchema;
|