0.0.4 • Published 6 months ago
@obvcloud/openapi-sdk v0.0.4
@obvcloud/openapi-sdk
Install
$ pnpm install
$ npm run dev
$ npm run build
Usage
可在根目录建立 test 文件夹, 用于存放测试文件 test.ts,测试代码如下
import { generateService } from "../dist/cjs";
generateService({
requestLibPath: "import request from '@/request';",
schemaPath: `http://127.0.0.1:4523/export/openapi/2?version=3.0`,
serversPath: "./servers",
}).then((r) => {});
之后可以通过命令或者方法调用此库功能
sudo ts-node ./test.ts
参数说明
属性 必填 备注 类型 默认值 requestLibPath 否 自定义请求方法路径 string - serversPath 否 生成的文件夹的路径 string - schemaPath 否 Swagger 2.0 或 OpenAPI 3.0 的地址 string - apiStatus 否 apifox 中的接口状态作为生成代码的范围,默认已发布接口可生成代码,可填入:(已发布:released,将废弃 deprecated,测试中:testing,开发中:developing) string[] 'released' projectName 否 项目名称 string - namespace 否 命名空间名称 string API enumStyle 否 枚举样式 string-literal | enum string-literal nullable 否 使用 null 代替可选 boolean false dataFields 否 response 中数据字段 string[] -
Options
TODO
LICENSE
MIT