1.1.14 • Published 12 months ago

openapi2ts v1.1.14

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

使用

npm i --save-dev openapi2ts

在项目根目录新建 openapi.config.ts

const { generateService } = require('openapi2ts')

generateService({
  schemaPath: 'http://petstore.swagger.io/v2/swagger.json',
  serversPath: './servers',
})

package.jsonscript 中添加 api: "openapi": "ts-node openapi.config.ts",

生成api

npm run openapi

参数

属性必填备注类型
requestLibPath自定义请求方法路径string
requestImportStatement自定义请求方法表达式string
apiPrefixapi 的前缀string
serversPath生成的文件夹的路径string
schemaPathopenAPI 3.0 的地址string
projectName项目名称string
namespace命名空间名称string
mockFoldermock目录string
1.1.12

12 months ago

1.1.14

12 months ago

2.0.1

12 months ago

1.1.13

12 months ago

1.1.9

1 year ago

1.1.10

1 year ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago