extendSchema.d.ts 1.4 KB

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