docs: function extractPath(schemaPath) {
    const subNames = schemaPath.path.split('.');
  
    return reduceRight(subNames, (fields, name, key) => {
      const obj = {};
  
      if (schemaPath instanceof mongoose.Schema.Types.DocumentArray) {
        const subSchemaPaths = schemaPath.schema.paths;
        const fields = extractPaths(subSchemaPaths, { name }); // eslint-disable-line no-use-before-define
        obj[name] = {
          name,
          fields,
          nonNull: false,
          type: 'Array',
          subtype: 'Object'
        };
      } else if (schemaPath instanceof mongoose.Schema.Types.Embedded) {
        schemaPath.modelName = schemaPath.schema.options.graphqlTypeName || name;
        // embedded model must be unique Instance
        const embeddedModel = embeddedModels.hasOwnProperty(schemaPath.modelName)
          ? embeddedModels[schemaPath.modelName]
          : getModel(schemaPath); // eslint-disable-line no-use-before-define
  
        embeddedModels[schemaPath.modelName] = embeddedModel;
        obj[name] = {
          ...getField(schemaPath),
          embeddedModel
        };
      } else if (key === subNames.length - 1) {
        obj[name] = getField(schemaPath);
      } else {
        obj[name] = {
          name,
          fields,
          nonNull: false,
          type: 'Object'
        };
      }
  
      return obj;
    }, {});
  }