From 28a65fc668524ec8125c427805756d0be507db5f Mon Sep 17 00:00:00 2001 From: YassinEldeeb Date: Tue, 9 May 2023 05:28:27 +0300 Subject: [PATCH] doc: add note to printSchema about the missing directives --- src/utilities/printSchema.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/utilities/printSchema.ts b/src/utilities/printSchema.ts index c987f64ae1..dd6746b8dc 100644 --- a/src/utilities/printSchema.ts +++ b/src/utilities/printSchema.ts @@ -36,6 +36,18 @@ import type { GraphQLSchema } from '../type/schema.js'; import { astFromValue } from './astFromValue.js'; +/** + * Returns a string representation of the given `GraphQLSchema` in SDL format. + * + * **Note**: This function will *not* print directives in the SDL format. + * If your intent is to print a schema with directives, use [`printSchemaWithDirectives`](https://the-guild.dev/graphql/tools/docs/api/modules/utils_src#printschemawithdirectives) instead. + * + * ## Example + * Given a schema, convert it to SDL + * ``` + * const sdl = printSchema(schema); + * ``` + */ export function printSchema(schema: GraphQLSchema): string { return printFilteredSchema( schema,