1.4.0 • Published 7 months ago

@ccs-ui/plugin-openapi v1.4.0

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

open-api 可视化代码生成插件

特性

  • 本地打开 Swagger UI
  • 本地打开 Swagger UI TS 版本
  • 在线生成代码文件:http 请求和 typing.d 定义文件
  • typing 泛型化
  • 根据 controller 生成独立文件

插件安装

  • pnpm add @ccs-ui/open-api

插件启用

export default defineConfig({
  ccsOpenApi: [
    {
      projectName: 'default',
      serversPath: './src/service',
      schemaPath: 'http://136.25.60.144:30472/api/service-sysmgr/v3/api-docs',
      authorization: `Basic bWljcm86QE1pY3JvLC4xMjM=`,
      namespace: 'API',
      requestImportStatement: `import { request } from '@/utils/http'`,
    },
    {
      projectName: 'easy-im',
      serversPath: './src/service',
      schemaPath: 'http://136.25.60.143:30314/easy/easy-im/v3/api-docs',
      authorization: `Basic bWljcm86QE1pY3JvLC4xMjM=`,
      namespace: 'APIM',
      requestImportStatement: `import { request } from '@/utils/http'`,
    },
  ],
});

参数说明

  • projectName 项目服务名称。
  • serversPath 请求和定义文件生成目录。
  • schemaPath 接口信息地址,参考 swagger 获取的数据。
  • authorization 文档登录凭证。
  • namespace typing 定义的命名空间。
  • requestImportStatement: 本地 http 请求引入

生成结果示例

import { request } from '@/utils/http';

/** 清空所有缓存 */
export async function clearAllCachesUsingGet() {
  return request<API.Result<void>>(
    '/easy-im/access/CacheController/clearAllCaches',
    {
      method: 'GET',
    },
  );
}

/** 清空所有组织缓存 */
export async function clearAllOrgsCacheUsingGet() {
  return request<API.Result<void>>(
    '/easy-im/access/CacheController/clearAllOrgsCache',
    {
      method: 'GET',
    },
  );
}
declare namespace API {
  type Result<T> = {
    /** 错误编码 */
    code?: string;
    /** 业务数据 */
    data?: T;
    /** 错误信息 */
    msg?: string;
    /** 业务调用是否成功 */
    success?: boolean;
  };
}
1.4.0

7 months ago

1.3.9

7 months ago

1.3.8

7 months ago

1.3.7

7 months ago

1.3.7-beta-2

7 months ago

1.3.7-beta-1

7 months ago

1.3.6

7 months ago

1.3.5

8 months ago

1.3.4

8 months ago

1.3.3

8 months ago

1.3.2

8 months ago

1.3.1

8 months ago

1.3.0

8 months ago

1.2.9

8 months ago

1.2.8

8 months ago

1.2.7

8 months ago

1.2.6

8 months ago

1.2.5

8 months ago

1.2.4

8 months ago

1.2.3

8 months ago

1.2.2

8 months ago

1.2.1

8 months ago

1.2.0

8 months ago

1.1.9

8 months ago

1.1.8

8 months ago

1.1.7

8 months ago

1.1.5

8 months ago

1.1.4

8 months ago

1.1.3

9 months ago

1.1.2

9 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago