UNPKG

@graphql-inspector/action

Version:

GraphQL Inspector functionality for GitHub Actions

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}`); } }