diff --git a/app/dociql/fetch-schema.js b/app/dociql/fetch-schema.js index c4505e1c..f5246e51 100644 --- a/app/dociql/fetch-schema.js +++ b/app/dociql/fetch-schema.js @@ -1,13 +1,12 @@ -const graphql = require('graphql') +const { getIntrospectionQuery, buildClientSchema } = require('graphql') const request = require("sync-request") const converter = require('graphql-2-json-schema'); -module.exports = function (graphUrl, authHeader) { - +module.exports = function (graphUrl, authHeader) { const requestBody = { operationName: "IntrospectionQuery", - query: graphql.introspectionQuery + query: getIntrospectionQuery() }; const headers = authHeader ? Object.fromEntries([authHeader.split(":")]) : {}; @@ -17,10 +16,10 @@ module.exports = function (graphUrl, authHeader) { json: requestBody }).getBody('utf8'); - const introspectionResponse = JSON.parse(responseBody); + const introspectionResponse = JSON.parse(responseBody); + const graphQLSchema = buildClientSchema(introspectionResponse.data); const jsonSchema = converter.fromIntrospectionQuery(introspectionResponse.data); - const graphQLSchema = graphql.buildClientSchema(introspectionResponse.data, { assumeValid: true}); return { jsonSchema, diff --git a/package.json b/package.json index 93096d6c..17ccfe3c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dociql", - "version": "1.1.2", + "version": "1.1.3", "description": "Generate beautiful static API documentation from GraphQL Schema", "preferGlobal": true, "bin": {