Skip to content

Commit 28a65fc

Browse files
committed
doc: add note to printSchema about the missing directives
1 parent d75872f commit 28a65fc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/utilities/printSchema.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ import type { GraphQLSchema } from '../type/schema.js';
3636

3737
import { astFromValue } from './astFromValue.js';
3838

39+
/**
40+
* Returns a string representation of the given `GraphQLSchema` in SDL format.
41+
*
42+
* **Note**: This function will *not* print directives in the SDL format.
43+
* 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.
44+
*
45+
* ## Example
46+
* Given a schema, convert it to SDL
47+
* ```
48+
* const sdl = printSchema(schema);
49+
* ```
50+
*/
3951
export function printSchema(schema: GraphQLSchema): string {
4052
return printFilteredSchema(
4153
schema,

0 commit comments

Comments
 (0)