0.0.9 • Published 5 years ago

@l-l/swagger2dts v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

swagger2dts

swagger.yml转为d.ts类型定义文件

swagger.yml => typing.d.ts

用法

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

例如:

swagger2dts ./swagger.yml ./typing.d.ts
  1. 引入包使用
const swagger2dts = require('@l-l/swagger2dts')
const fs = require('fs');

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

// 转换
const dts = swagger2dts(swaggeryml);

// 写
fs.writeFileSync('xx/typing.d.ts',  dts);