@api-components/api-annotation-document

中文文档
4.2.2发布于 2021/10/28Apache-2.0ESM + CJS近 30 天下载 3141

基于 AMF 数据模型生成 RAML 注释的元素

中文使用文档
文档目录8 节
  1. 版本兼容性
  2. 使用量
  3. 安装
  4. 在 html 文件内
  5. 在一个LitElement中
  6. 发展
  7. 本地运行演示
  8. 运行测试

被否决

这一部分正在贬值。 代码基础已移动到 api 文档 模块。 此模块将在 第37号共和国文件 合并.


基于AMF数据模型生成 RAML 注释的元素 .

Published on NPM

Tests and publishing

版本兼容性

此版本仅与AMF模式版本2(AMF parser QQ 4.0.0)相通. 用于与上一个模型版本的兼容性 3.x.x 版本的组件.

使用量

安装

npm install --save @api-components/api-annotation-document

元素需要设置 amf 属性,并带有完整的生成的AMF模型,以正确解决紧凑的JSON模型. 它还要求设置 shape 属性到当前记录的 API 属性(端点、方法、类型(包括类型属性)、安全、安全设置等).

在 html 文件内

<html>
  <head>
    <script type="module">
      import '@api-components/api-annotation-document/api-annotation-document.js';
    </script>
  </head>
  <body>
    <api-annotation-document></api-annotation-document>
    <script>
    {
      const model = await getAmfModelSomehow();
      const shape = computeCurrentShape(model, someId);
      const aad = document.querySelector('api-annotation-document');
      aad.amf = model;
      aad.shape = shape;
    }
    </script>
  </body>
</html>

在一个LitElement中

import { LitElement, html } from 'lit-element';
import '@api-components/api-annotation-document/api-annotation-document.js';

class SampleElement extends LitElement {
  render() {
    return html`
    <api-annotation-document
      .amf="${this.model}"
      .shape="${this.shape}"
    ></api-annotation-document>
    `;
  }
}
customElements.define('sample-element', SampleElement);

发展

git clone https://github.com/advanced-rest-client/api-annotation-document
cd api-annotation-document
npm install

本地运行演示

npm start

运行测试

npm test

版本与发布记录

@api-components/api-annotation-document 共发布 14 个版本,首次发布于 2018/05/19;过去 12 个月发布了 0 个版本。

版本发布日期距今
4.2.2latest2021/10/285 年前
4.2.12021/09/295 年前
4.2.02021/03/135 年前
4.1.02020/11/265 年前
4.0.32020/02/196 年前
4.0.22020/01/076 年前

关于 @api-components/api-annotation-document 的常见问题

@api-components/api-annotation-document 是什么?

基于 AMF 数据模型生成 RAML 注释的元素

如何安装 @api-components/api-annotation-document?

在项目目录运行 npm install @api-components/api-annotation-document,或使用 pnpm add / yarn add / bun add。

@api-components/api-annotation-document 支持 TypeScript 吗?

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

@api-components/api-annotation-document 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@api-components/api-annotation-document 可以商用吗?

@api-components/api-annotation-document 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@api-components/api-annotation-document 的下载量有多少?

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

@api-components/api-annotation-document 还在维护吗?

最新版本 4.2.2 发布于 2021/10/28(5 年前);至今共发布 14 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/05/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。