@ama-openapi/redocly-plugin

中文文档
15.3.2发布于 2026/11/13BSD-3-ClauseES Module构建来源已验证近 30 天下载 3211

Redocly plugins library to manage OpenAPI models

原始使用文档
文档目录10 节
  1. Overview
  2. Features
  3. Installation
  4. Usage
  5. Basic Configuration
  6. Dependency Retrieval
  7. Masking Configuration
  8. Available plugin configurations
  9. Additional custom decorators
  10. Integration

Ama OpenAPI Redocly Plugin

[!WARNING] Experimental: This package is available in early access, the final version will be released in v15.

Stable Version Bundle Size

A Redocly CLI plugin for managing OpenAPI dependencies and masking operations based on @ama-openapi/core.

Overview

This plugin extends the Redocly CLI with functionality to handle OpenAPI dependency setup and content masking. It leverages the core dependency management system provided by @ama-openapi/core to automatically resolve and integrate OpenAPI dependencies in your specifications.

Features

  • Dependency management: Automatically resolves and manages OpenAPI dependencies
  • Content masking: Applies masking rules to hide or transform sensitive information in OpenAPI specifications
  • Redocly integration: Seamlessly integrates with the Redocly CLI toolchain
  • Configurable: Supports custom configuration for dependency resolution and masking rules

Installation

npm install @ama-openapi/redocly-plugin

Usage

Basic Configuration

Add the plugin to your Redocly configuration file (.redocly.yaml or redocly.yaml):

plugins:
  - '@ama-openapi/redocly-plugin'

Dependency Retrieval

The plugin retrieves dependencies defined in your OpenAPI Configuration:

// in the package.json file
{
  "name": "@my/specification",
  "dependencies": {
    "@specification/pet-store": "latest"
  }
}
# in the openapi.manifest.yaml
models:
  "@specification/pet-store": "models/pet.v1.yaml"
# in your specification
openapi: 3.0.0
info:
  title: My API
  version: 1.0.0

content:
  application/json:
    schema:
      type: object
        properties:
          data:
            $ref: './specification/pet-store/models/pet.v1.yaml'

[!TIP] Find the documentation regarding the package management strategy on Node Package Manager.
Find a complete documentation regarding the Manifest on the OpenAPI Configuration.

Masking Configuration

A full documentation on masking specified information is available in OpenAPI Masking configuration.
A simple example can be:

# in the openapi.manifest.yaml
models:
  "@specification/pet-store":
    - path: "models/pet.v1.yaml"
      transform:
        - fileRename: "my-$1"
          mask:
            properties:
              exampleField:

Available plugin configurations

As the plugin must be executed at the initialization of the Redocly process, the configuration of the plugin should be provided via environment variables.

The following environment variables are supported:

Environment VariableDescriptionDefault Value
AMA_OPENAPI_REDOCLY_CONTINUE_ON_ERRORIgnore process failure and continue Redocly processfalse
AMA_OPENAPI_REDOCLY_VERBOSEDisplay debug level logsfalse
AMA_OPENAPI_REDOCLY_QUIETSuppress all outputfalse

Additional custom decorators

The plugin offer additional Redocly decorator which can be selected and configured in Redocly configuration.

The full list of available decorators, along with their options, is provided in the dedicated documentation.

Integration

This Redocly Plugin is designed to work with the following tools:

版本与发布记录

@ama-openapi/redocly-plugin 共发布 512 个版本,首次发布于 2025/11/01;过去 12 个月发布了 502 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
15.3.2latest2026/11/13今天
15.2.5v15-updated2026/11/131 天前
15.1.42026/11/131 天前
15.4.0-prerelease.11prerelease2026/11/131 天前
15.4.0-prerelease.102026/11/121 天前
15.3.12026/11/103 天前

其他发布通道:next → 14.0.0-next.14,v13-updated → 13.5.13,v14-updated → 14.5.4,rc → 15.3.0-rc.2,prerelease → 15.4.0-prerelease.11,v15-updated → 15.2.5。

关于 @ama-openapi/redocly-plugin 的常见问题

@ama-openapi/redocly-plugin 是什么?

Redocly plugins library to manage OpenAPI models

如何安装 @ama-openapi/redocly-plugin?

在项目目录运行 npm install @ama-openapi/redocly-plugin,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@redocly/openapi-core(^2.11.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ama-openapi/redocly-plugin 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/ama-openapi__redocly-plugin 是否存在。

@ama-openapi/redocly-plugin 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@ama-openapi/redocly-plugin 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^22.22.3 || ^24.15.0 || ^26.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ama-openapi/redocly-plugin 可以商用吗?

@ama-openapi/redocly-plugin 使用 BSD-3-Clause 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。另外不得用原作者名义为衍生产品背书。以上为概括,不构成法律意见,请以许可原文为准。

@ama-openapi/redocly-plugin 的下载量有多少?

根据 npm 官方下载统计,@ama-openapi/redocly-plugin 在 2026/10/06 – 2026/11/04 这 30 天内被下载 3,211 次,日均约 107 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ama-openapi/redocly-plugin 还在维护吗?

最新版本 15.3.2 发布于 2026/11/13(今天);至今共发布 512 个版本,其中过去 12 个月发布了 502 个;首次发布于 2025/11/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。