UNPKG

@graphql-tools/utils

Version:

Common package containing utils and types for GraphQL tools

19 lines (18 loc) 564 B
import { Kind } from 'graphql'; export 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: Kind.STRING, value: obj.description, block: true, }; } if (obj.astNode?.description) { return { ...obj.astNode.description, block: true, }; } }