Skip to content

Commit

Permalink
0.8.2 - Allow overriding options for both buildASTSchema and `merge…
Browse files Browse the repository at this point in the history
…TypeDefs`
  • Loading branch information
mayel committed Apr 26, 2020
1 parent e39f3b3 commit 2206b8b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.8.2

- Allow overriding options for both `buildASTSchema` and `mergeTypeDefs`

## 0.8.1

- Allow overriding options to `mergeTypeDefs` in order to deal with looser validation in extension schemas
Expand Down
13 changes: 9 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@ const { mergeTypeDefs } = require('@graphql-toolkit/schema-merging')

const { schemaModules, bridgingSchemas } = require('./schema-manifest')

function buildSchema(moduleIds, extensionSchemas, options) {
function buildSchema(moduleIds, extensionSchemas, merge_options, build_options) {
// default to all modules
if (!moduleIds || !moduleIds.length) {
moduleIds = Object.keys(schemaModules)
}

if (!options) {
options = { throwOnConflict: true }
if (!merge_options) {
merge_options = { throwOnConflict: true }
}

if (!build_options) {
build_options = { assumeValidSDL: false }
}


// util types are always required
moduleIds.push('util')

Expand Down Expand Up @@ -50,7 +55,7 @@ function buildSchema(moduleIds, extensionSchemas, options) {
})

// merge fragments and build GraphQLSchema object
return buildASTSchema(mergeTypeDefs(fragments.concat(extensionSchemas || []), options))
return buildASTSchema(mergeTypeDefs(fragments.concat(extensionSchemas || []), merge_options), build_options)
}

module.exports = {
Expand Down
4 changes: 2 additions & 2 deletions lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@valueflows/vf-graphql",
"version": "0.8.1",
"version": "0.8.2",
"description": "Reference GraphQL implementation of the ValueFlows spec",
"main": "index.js",
"types": "index.d.ts",
Expand Down Expand Up @@ -72,4 +72,4 @@
"tape": "^4.10.0",
"tape-catch": "^1.0.6"
}
}
}

0 comments on commit 2206b8b

Please sign in to comment.