lib/request-resolver.js
function mergeSubResource(attrNode, subResourceConfig, context) {
    // Merge options from sub-resource to parent (order is irrelevant here):
    Object.keys(subResourceConfig).forEach(optionName => {
        if (optionName === 'attributes') {
            if (!attrNode.attributes) attrNode.attributes = {};
        } else if (optionName === 'dataSources') {
            const newDataSources = Object.assign({}, subResourceConfig.dataSources);

            if (attrNode.dataSources) {
                Object.keys(attrNode.dataSources).forEach(dataSourceName => {
                    if (newDataSources[dataSourceName]) {
                        if (attrNode.dataSources[dataSourceName].inherit) {
                            if (attrNode.dataSources[dataSourceName].inherit === 'inherit') {
                                newDataSources[dataSourceName] = Object.assign(
                                    {},
                                    newDataSources[dataSourceName],
                                    attrNode.dataSources[dataSourceName]
                                );
                            } else if (attrNode.dataSources[dataSourceName].inherit === 'replace') {
                                newDataSources[dataSourceName] = attrNode.dataSources[dataSourceName];
                            }
                        } else {
                            throw new ImplementationError(
                                `Cannot overwrite DataSource "${dataSourceName}"` +
                                    ` in "${context.attrPath.join('.')}" (maybe use "inherit"?)`
                            );
                        }
                    } else {
                        newDataSources[dataSourceName] = attrNode.dataSources[dataSourceName];
                    }
                });
            }

            attrNode.dataSources = newDataSources;
        } else if (typeof subResourceConfig[optionName] === 'object') {
            attrNode[optionName] = cloneDeep(subResourceConfig[optionName]);
        } else if (!(optionName in attrNode)) {
            attrNode[optionName] = subResourceConfig[optionName];
        }
    });

    attrNode._origNodes = attrNode._origNodes || [];
    attrNode._origNodes.push(subResourceConfig);
}
function mergeSubResource(attrNode, subResourceConfig, context) {
    // Merge options from sub-resource to parent (order is irrelevant here):
    Object.keys(subResourceConfig).forEach(optionName => {
        if (optionName === 'attributes') {
            if (!attrNode.attributes) attrNode.attributes = {};
        } else if (optionName === 'dataSources') {
            const newDataSources = Object.assign({}, subResourceConfig.dataSources);

            if (attrNode.dataSources) {
                Object.keys(attrNode.dataSources).forEach(dataSourceName => {
                    if (newDataSources[dataSourceName]) {
                        if (attrNode.dataSources[dataSourceName].inherit) {
                            if (attrNode.dataSources[dataSourceName].inherit === 'inherit') {
                                newDataSources[dataSourceName] = Object.assign(
                                    {},
                                    newDataSources[dataSourceName],
                                    attrNode.dataSources[dataSourceName]
                                );
                            } else if (attrNode.dataSources[dataSourceName].inherit === 'replace') {
                                newDataSources[dataSourceName] = attrNode.dataSources[dataSourceName];
                            }
                        } else {
                            throw new ImplementationError(
                                `Cannot overwrite DataSource "${dataSourceName}"` +
                                    ` in "${context.attrPath.join('.')}" (maybe use "inherit"?)`
                            );
                        }
                    } else {
                        newDataSources[dataSourceName] = attrNode.dataSources[dataSourceName];
                    }
                });
            }

            attrNode.dataSources = newDataSources;
        } else if (typeof subResourceConfig[optionName] === 'object') {
            attrNode[optionName] = cloneDeep(subResourceConfig[optionName]);
        } else if (!(optionName in attrNode)) {
            attrNode[optionName] = subResourceConfig[optionName];
        }
    });

    attrNode._origNodes = attrNode._origNodes || [];
    attrNode._origNodes.push(subResourceConfig);
}
function mergeSubResource ( attrNode , subResourceConfig , context ) { // Merge options from sub-resource to parent (order is irrelevant here): Object . keys ( subResourceConfig ) . forEach ( optionName => { if ( optionName === 'attributes' ) { if ( ! attrNode . attributes ) attrNode . attributes = { } ; } else if ( optionName === 'dataSources' ) { const newDataSources = Object . assign ( { } , subResourceConfig . dataSources ) ; if ( attrNode . dataSources ) { Object . keys ( attrNode . dataSources ) . forEach ( dataSourceName => { if ( newDataSources [ dataSourceName ] ) { if ( attrNode . dataSources [ dataSourceName ] . inherit ) { if ( attrNode . dataSources [ dataSourceName ] . inherit === 'inherit' ) { newDataSources [ dataSourceName ] = Object . assign ( { } , newDataSources [ dataSourceName ] , attrNode . dataSources [ dataSourceName ] ) ; } else if ( attrNode . dataSources [ dataSourceName ] . inherit === 'replace' ) { newDataSources [ dataSourceName ] = attrNode . dataSources [ dataSourceName ] ; } } else { throw new ImplementationError ( ` ${ dataSourceName } ` + ` ${ context . attrPath . join ( '.' ) } ` ) ; } } else { newDataSources [ dataSourceName ] = attrNode . dataSources [ dataSourceName ] ; } } ) ; } attrNode . dataSources = newDataSources ; } else if ( typeof subResourceConfig [ optionName ] === 'object' ) { attrNode [ optionName ] = cloneDeep ( subResourceConfig [ optionName ] ) ; } else if ( ! ( optionName in attrNode ) ) { attrNode [ optionName ] = subResourceConfig [ optionName ] ; } } ) ; attrNode . _origNodes = attrNode . _origNodes || [ ] ; attrNode . _origNodes . push ( subResourceConfig ) ; }
Merges additional options, attributes and DataSources from parent-resource
into sub-resource.

@param attrNode - Destination node
@param subResourceConfig - Sub-resource-config (not cloned!)
@private
Merges additional options attributes and DataSources from parent - resource into sub - resource .