@axway/swagger-tools

中文文档
1.1.0发布于 2025/09/15MITCommonJS近 30 天下载 2394

Various tools for using and integrating with Swagger 2.0.

原始使用文档
文档目录8 节
  1. Project Badges
  2. Supported Swagger Versions
  3. Features
  4. Installation
  5. Browser
  6. Node.js
  7. Documentation
  8. Contributing

The project provides various tools for integrating and interacting with Swagger. This project is in its infancy but what is within the repository should be fully tested and reusable. Please visit the issue tracker to see what issues we are aware of and what features/enhancements we are working on. Otherwise, feel free to review the Release Notes to see what is new and improved.

Project Badges

Join the chat at https://gitter.im/apigee-127/swagger-tools

  • Build status: Build Status
  • Dependencies: Dependencies
  • Developer dependencies: Dev Dependencies
  • Downloads: NPM Downloads Per Month
  • License: License
  • Bower Version NPM Version
  • NPM Version: NPM Version

Supported Swagger Versions

Features

  • Simple CLI
    • Validate Swagger document(s)
    • Convert Swagger 1.2 documents to Swagger 2.0
  • Schema validation: For the file(s) supported by the Swagger specification, ensure they pass structural validation based on the JSON Schema associated with that version of the specification (Browser and Node)
  • Semantic validation: Validates Swagger files above and beyond the structure of the file (Browser and Node)
  • Connect middleware for adding pertinent Swagger information to your requests (Node only)
  • Connect middleware for wiring up security handlers for requests based on Swagger documentation (Node only)
  • Connect middleware for wiring request handlers to requests based on Swagger documentation (Node only)
  • Connect middleware for serving your Swagger documents and Swagger UI (Node only)
  • Connect middleware for using Swagger resource documents for pre-route validation (Node only)
    • Validate the request/response Content-Type based on the operation's consumes/produces value(s)
    • Validate the request parameter types
    • Validate the request parameter values
    • Validate the response values

Installation

Swagger Tools is available for both Node.js and the browser. Installation instructions for each environment are below.

Browser

Installation for browser applications can be done via Bower or by downloading a standalone binary.

Using Bower

bower install swagger-tools --save

Standalone Binaries

The standalone binaries come in two flavors:

Node.js

Installation for Node.js applications can be done via NPM.

npm install swagger-tools --save

If you want to use the swagger-tools executable for validating Swagger documents, you can install swagger-tools globally using the following:

npm install -g swagger-tools

Documentation

swagger-tools is heavily documented so head on over to the project documentation or jump straight to the Quick Start.

Contributing

This project uses Gulp for building so npm install -g gulp once you clone this project. Running gulp in the project root will lint check the source code and run the unit tests.

版本与发布记录

@axway/swagger-tools 共发布 14 个版本,首次发布于 2020/10/28;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.1.0latest2025/09/151.1 年前
1.0.02022/09/194 年前
1.0.0-02022/09/154 年前
0.12.0-02022/09/134 年前
0.11.52021/12/014 年前
0.11.42021/07/165 年前

关于 @axway/swagger-tools 的常见问题

@axway/swagger-tools 是什么?

Various tools for using and integrating with Swagger 2.0.

如何安装 @axway/swagger-tools?

在项目目录运行 npm install @axway/swagger-tools,或使用 pnpm add / yarn add / bun add。

@axway/swagger-tools 支持 TypeScript 吗?

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

@axway/swagger-tools 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@axway/swagger-tools 需要什么版本的 Node.js?

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

@axway/swagger-tools 可以商用吗?

@axway/swagger-tools 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@axway/swagger-tools 的下载量有多少?

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

@axway/swagger-tools 还在维护吗?

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