jiaxing.liao 0f78ae27e1 fix: 调整内容 il y a 4 semaines
..
schema 0f78ae27e1 fix: 调整内容 il y a 4 semaines
servers 0f78ae27e1 fix: 调整内容 il y a 4 semaines
README.md 3aba922beb init: 初始化项目 il y a 4 mois
index.ts ad93589ff8 feat: 添加知识库,资源,智能体模块 il y a 1 mois
openapi2ts.config.ts ad93589ff8 feat: 添加知识库,资源,智能体模块 il y a 1 mois
package.json 3aba922beb init: 初始化项目 il y a 4 mois
tsconfig.json 3aba922beb init: 初始化项目 il y a 4 mois
vite-env.d.ts 0dd9dd0a06 feat: 添加知识库功能,调整apiserver分块 il y a 1 mois

README.md

生成 TypeScript 接口与类型

简要说明:使用@umijs/openapi根据 API 文档(OpenAPI/Swagger)生成对应的 TypeScript 接口与类型,使用 genapi 脚本调用,配置文件参考 openapi2ts.config.js

1. 文件结构(示例)

  • schema.json — OpenAPI 文档
  • openapi2ts.config.js — 生成器配置
  • packages/api-service/src/types/api.ts — 生成结果
  • package.json

2. package.json 脚本

在 packages/api-service/package.json 或仓库根目录的 package.json 中添加:

{
  "scripts": {
    "genapi": "openapi2ts"
  }
}

可使用pnpm运行:

pnpm run genapi

3. 示例配置:openapi2ts.config.js

配置参考链接:https://github.com/781574155/openapi2typescript#readme