Created
September 19, 2018 01:09
-
-
Save tlivings/6e9f1053b47cf5207ac9891331ed5abf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mergePartials(partials) { | |
const types = []; | |
const resolvers = []; | |
for (const partial of partials) { | |
resolvers.push(partial.resolvers); | |
Array.isArray(partial.types) ? types.push(...partial.types) : types.push(partial.types); | |
} | |
addEmptyRootTypes(types, resolvers); | |
const mergedResolvers = merge({}, ...resolvers); | |
return makeExecutableSchema({ typeDefs: types, resolvers: mergedResolvers }); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment