
基于Swagger OpenAPI规范的TypeScript类型生成器: openapi-typescript
5星
- 浏览量: 0
- 大小:None
- 文件类型:None
简介:
openapi-typescript是一款工具,它能够依据Swagger OpenAPI规范自动生成TypeScript类型定义文件,极大地简化了前后端开发者的接口类型管理与维护工作。
使用Node.js将OpenAPI模式转换为TypeScript接口的脚本:
命令行界面用法:
- 从文件系统读取规范
```shell
npx openapi-typescript schema.yaml --output schema.ts
```
这会加载`schema.yaml`并生成一个名为`schema.ts`的输出文件。
- 从远程资源读取规范
```shell
npx openapi-typescript https://petstore.swagger.io/v2/swagger.json --output petstore.ts
```
这将从指定URL加载OpenAPI规范,并创建一个名为 `petstore.ts` 的TypeScript接口。
全部评论 (0)
还没有任何评论哟~


