UNPKG

@graphql-inspector/action

Version:

GraphQL Inspector functionality for GitHub Actions

19 lines (18 loc) 532 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.produceSchema = produceSchema; const graphql_1 = require("graphql"); function produceSchema(source) { try { if (!source.body.trim().length) { throw new Error(`Content is empty`); } return (0, graphql_1.buildSchema)(source, { assumeValid: true, assumeValidSDL: true, }); } catch (e) { throw new Error(`Failed to parse "${source.name}": ${e.message}`); } }