fast-openapi
v1.0.1
Published
A CLI tool to read Swagger/OpenAPI JSON files and generate API call files
Readme
fast-openapi
一个 CLI 工具,用于读取 Swagger/OpenAPI JSON 文件并生成 Typescript API 调用文件, 目前只支持windows, 内部调用的工具源码在https://github.com/helloweilei/ropenapi, 可自行修改、打包及构建。
安装
npm install -g fast-openapi或在项目中安装:
npm install fast-openapi --save-dev使用
- 在你的项目根目录下创建配置文件
.swaggerrc.json或.swaggerrc.js
.swaggerrc.json 示例:
{
"requestLibPath": "import { request } from '@umijs/request';",
"schemaPath": "http://localhost:3000/api-docs",
"projectName": "my-project",
"apiPrefix": "/order",
"servicePath": "project_path/src/services"
}.swaggerrc.js 示例:
module.exports = {
requestLibPath: "import { request } from '@umijs/request';",
schemaPath: "http://localhost:3000/api-docs",
projectName: "my-project",
apiPrefix: "/order",
servicePath: path.join(__dirname, "src", "services"),
};- 运行命令:
fast-openapi许可证
MIT
