buildASTSchema.d.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import type { DocumentNode } from '../language/ast';
  2. import type { ParseOptions } from '../language/parser';
  3. import type { Source } from '../language/source';
  4. import type { GraphQLSchemaValidationOptions } from '../type/schema';
  5. import { GraphQLSchema } from '../type/schema';
  6. export 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. */
  24. export 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. */
  32. export declare function buildSchema(
  33. source: string | Source,
  34. options?: BuildSchemaOptions & ParseOptions,
  35. ): GraphQLSchema;