UNPKG

@graphql-tools/utils

Version:

Common package containing utils and types for GraphQL tools

22 lines (21 loc) 699 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDescriptionNode = getDescriptionNode; const graphql_1 = require("graphql"); function getDescriptionNode(obj) { // Prefer the runtime `description` over a stale `astNode` description. // Schema transforms (e.g. mapSchema) update config descriptions without rewriting astNode (#5508). if (typeof obj.description === 'string') { return { kind: graphql_1.Kind.STRING, value: obj.description, block: true, }; } if (obj.astNode?.description) { return { ...obj.astNode.description, block: true, }; } }