@l-l/swagger2
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

swagger2

swagger.yml转为api.json标准格式

swagger.yml => api.json

用法

npm install @l-l/swagger2
  1. 命令行使用
swagger2 <path> <output>

例如:

swagger2 ./swagger.yml ./api.json
  1. 引入包使用
const swagger2 = require('@l-l/swagger2')
const fs = require('fs');

// 读取swagger.yml
const swaggeryml = fs.readFileSync('xx/swagger.yml').toString();

// 转换
const api = swagger2(swaggeryml);

// 写
fs.writeFileSync('xx/api.json',  JSON.stringify(api));

Readme

Keywords

none

Package Sidebar

Install

npm i @l-l/swagger2

Weekly Downloads

0

Version

0.0.9

License

MIT

Unpacked Size

18.8 kB

Total Files

12

Last publish

Collaborators

  • whj1995