code: function resolveIncludes(attrNode, context) {
      const maxDepth = 10;
      const includeStack = [];
      let subResourceConfig;
  
      while (attrNode.resource) {
          includeStack.push(attrNode.resource);
          if (includeStack.length >= maxDepth) {
              throw new ImplementationError(
                  'Resource inclusion depth too big' +
                      (context.attrPath.length > 0 ? ' at "' + context.attrPath.join('.') + '"' : '') +
                      ' (included from: ' +
                      includeStack.join(' -> ') +
                      ')'
              );
          }
  
          if (!context.resourceConfigs[attrNode.resource] || !context.resourceConfigs[attrNode.resource].config) {
              if (context.attrPath.length === 0 && includeStack.length === 1) {
                  throw new RequestError('Unknown resource "' + attrNode.resource + '"');
              } else {
                  throw new ImplementationError(
                      'Unknown resource "' +
                          attrNode.resource +
                          '"' +
                          (context.attrPath.length > 0 ? ' at "' + context.attrPath.join('.') + '"' : '') +
                          (includeStack.length > 1 ? ' (included from: ' + includeStack.join(' -> ') + ')' : '')
                  );
              }
          }
  
          subResourceConfig = context.resourceConfigs[attrNode.resource].config;
          attrNode.resourceName = attrNode.resource;
          delete attrNode.resource;
  
          mergeSubResource(attrNode, subResourceConfig, context);
      }
  }
docs: Resolve included resource (recursive at top level) and clone their configs deeply
  
  @private