UNPKG

@graphql-inspector/cli

Version:

Tooling for GraphQL. Compare GraphQL Schemas, check documents, find breaking changes, find similar types.

16 lines (15 loc) 409 B
import { buildSchema } from 'graphql'; export function produceSchema(source) { try { if (!source.body.trim().length) { throw new Error(`Content is empty`); } return buildSchema(source, { assumeValid: true, assumeValidSDL: true, }); } catch (e) { throw new Error(`Failed to parse "${source.name}": ${e.message}`); } }