mirror of
https://github.com/strapi/strapi.git
synced 2025-07-23 00:51:17 +00:00
25 lines
406 B
JavaScript
25 lines
406 B
JavaScript
![]() |
'use strict';
|
||
|
|
||
|
const _ = require('lodash');
|
||
|
|
||
|
/**
|
||
|
* Merges
|
||
|
*/
|
||
|
const mergeSchemas = (root, ...subs) => {
|
||
|
subs.forEach(sub => {
|
||
|
if (_.isEmpty(sub)) return;
|
||
|
const { definition = '', query = {}, mutation = {}, resolvers = {} } = sub;
|
||
|
|
||
|
root.definition += '\n' + definition;
|
||
|
_.merge(root, {
|
||
|
query,
|
||
|
mutation,
|
||
|
resolvers,
|
||
|
});
|
||
|
});
|
||
|
};
|
||
|
|
||
|
module.exports = {
|
||
|
mergeSchemas,
|
||
|
};
|