wangzhibo
2026-07-16 bac4362a0b7726d38a23d38f0d7913f2c2bab262
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { ModuleConfig } from '@cool-midway/core';
 
/**
 * 模块配置
 */
export default ({ app }) => {
  return {
    // 模块名称
    name: 'Swagger',
    // 模块描述
    description: '处理和生成swagger文档',
    // 中间件,只对本模块有效
    middlewares: [],
    // 中间件,全局有效
    globalMiddlewares: [],
    // 模块加载顺序,默认为0,值越大越优先加载
    order: 0,
    // swagger基本配置
    base: {
      openapi: '3.1.0',
      info: {
        title: 'Cool Admin 在线API文档',
        version: '8.x',
        description: '本文档是由Cool Admin内部自动构建完成',
        contact: {
          name: '开发文档',
          url: 'https://cool-js.com',
        },
      },
      // 请求地址
      servers: [
        {
          url: `http://127.0.0.1:${app?.getConfig('koa.port') || 8001}`,
          description: '本地后台地址',
        },
      ],
      paths: {},
      components: {
        schemas: {},
        securitySchemes: {
          ApiKeyAuth: {
            type: 'apiKey',
            name: 'Authorization',
            in: 'header',
          },
        },
      },
    },
  } as ModuleConfig;
};