Skip to content

Instantly share code, notes, and snippets.

@tlivings
Created September 19, 2018 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlivings/6e9f1053b47cf5207ac9891331ed5abf to your computer and use it in GitHub Desktop.
Save tlivings/6e9f1053b47cf5207ac9891331ed5abf to your computer and use it in GitHub Desktop.
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