刘洪青 | 483a21f | 2020-09-07 12:20:33 +0800 | [diff] [blame] | 1 | # admin-center-poa.v1.yaml |
| 2 | # |
| 3 | # 1. 创建服务 |
| 4 | # curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services' -H 'Content-Type: application/json' -d '{"id": "admincenter", "origin": "http://admin-center-poa-svc.admin-center.svc.cluster.local:8080", "name": "管理中心", "description": "管理中心"}' |
| 5 | # |
| 6 | # 2. 创建版本 |
| 7 | # curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/admincenter/apiVersions/v1' |
| 8 | # |
| 9 | # 3. 上传OAS Yaml |
| 10 | # curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/admincenter/apiVersions/v1/apiSpecs' -H 'Content-Type: application/yaml' --data-binary @admin-center-poa.v1.yaml |
| 11 | # |
| 12 | # 4. 发布版本 |
| 13 | # curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/admincenter/apiVersions/v1/publish' |
| 14 | # |
| 15 | openapi: 3.0.2 |
| 16 | info: |
| 17 | title: Admin Center Platform Open APIs |
| 18 | version: v1 |
| 19 | description: '管理中心 - 平台开放接口' |
| 20 | servers: |
| 21 | - url: 'http://poa-test.paas.newcapec.cn/apis/admincenter/v1' |
| 22 | description: '正式环境' |
| 23 | tags: |
| 24 | - name: Menu |
| 25 | description: '管理中心菜单' |
| 26 | paths: |
| 27 | |
| 28 | '/menus/accountName/{accountName}/menus': |
| 29 | get: |
| 30 | summary: 获取用户帐号可访问的菜单 |
| 31 | description: 获取用户帐号可访问的菜单 |
| 32 | operationId: loadAccountMenus |
| 33 | tags: |
| 34 | - Menu |
| 35 | security: |
| 36 | - oauth2: |
| 37 | - "admincenter:v1:readMenu" |
| 38 | parameters: |
| 39 | - name: accountName |
| 40 | in: path |
| 41 | required: true |
| 42 | description: 用户名 |
| 43 | schema: |
| 44 | type: string |
| 45 | # - name: applicationId |
| 46 | # in: query |
| 47 | # required: true |
| 48 | # description: 应用标识 |
| 49 | # schema: |
| 50 | # type: string |
| 51 | responses: |
| 52 | '200': |
| 53 | description: 菜单列表 |
| 54 | content: |
| 55 | application/json: |
| 56 | schema: |
| 57 | $ref: '#/components/schemas/GrantedMenusResponse' |
| 58 | default: |
| 59 | $ref: '#/components/responses/DefaultErrorResponse' |
| 60 | |
| 61 | |
| 62 | components: |
| 63 | |
| 64 | # Security Schemes |
| 65 | |
| 66 | securitySchemes: |
| 67 | oauth2: |
| 68 | type: oauth2 |
| 69 | flows: |
| 70 | clientCredentials: |
| 71 | tokenUrl: http://poa-test.paas.newcapec.cn/oauth2/token |
| 72 | scopes: |
| 73 | "admincenter:v1:readMenu": "读取后台菜单" |
| 74 | |
| 75 | responses: |
| 76 | 'ErrorResponse400': |
| 77 | description: unexpected error |
| 78 | content: |
| 79 | application/json: |
| 80 | schema: |
| 81 | $ref: '#/components/schemas/ErrorResponse' |
| 82 | |
| 83 | DefaultErrorResponse: |
| 84 | description: unexpected error |
| 85 | content: |
| 86 | application/json: |
| 87 | schema: |
| 88 | $ref: '#/components/schemas/ErrorResponse' |
| 89 | |
| 90 | schemas: |
| 91 | |
| 92 | # Error |
| 93 | |
| 94 | ErrorResponse: |
| 95 | title: '异常响应' |
| 96 | required: |
| 97 | - code |
| 98 | - message |
| 99 | properties: |
| 100 | code: |
| 101 | title: 异常代码 |
| 102 | type: integer |
| 103 | format: int32 |
| 104 | default: -1 |
| 105 | message: |
| 106 | title: 异常信息 |
| 107 | type: string |
| 108 | default: "未知错误" |
| 109 | |
| 110 | # DTO |
| 111 | |
| 112 | GrantedMenu: |
| 113 | title: DTO - 菜单数据 |
| 114 | type: object |
| 115 | properties: |
| 116 | id: |
| 117 | title: ID |
| 118 | type: string |
| 119 | code: |
| 120 | title: 代码 |
| 121 | type: string |
| 122 | name: |
| 123 | title: 名称 |
| 124 | type: string |
| 125 | memo: |
| 126 | title: 备注 |
| 127 | type: string |
| 128 | status: |
| 129 | title: 状态(1 启用,0 停用) |
| 130 | type: string |
| 131 | icon: |
| 132 | title: 菜单图标 |
| 133 | type: string |
| 134 | origin: |
| 135 | title: 来源系统 |
| 136 | type: string |
| 137 | url: |
| 138 | title: URL地址 |
| 139 | type: string |
| 140 | applicationId: |
| 141 | title: 系统ID |
| 142 | type: string |
| 143 | parentId: |
| 144 | title: 父级ID |
| 145 | type: string |
| 146 | order: |
| 147 | title: 排序 |
| 148 | type: string |
| 149 | |
| 150 | |
| 151 | # Request VO |
| 152 | |
| 153 | |
| 154 | # Response Data |
| 155 | |
| 156 | GrantedMenusResponseData: |
| 157 | title: 响应数据 - 菜单列表 |
| 158 | type: object |
| 159 | properties: |
| 160 | menus: |
| 161 | title: 菜单列表 |
| 162 | type: array |
| 163 | items: |
| 164 | $ref: '#/components/schemas/GrantedMenu' |
| 165 | |
| 166 | |
| 167 | # Response VO |
| 168 | |
| 169 | ApiDataResponse: |
| 170 | title: 响应 |
| 171 | properties: |
| 172 | code: |
| 173 | title: 响应代码 |
| 174 | type: integer |
| 175 | format: int32 |
| 176 | default: 0 |
| 177 | message: |
| 178 | title: 响应信息 |
| 179 | type: string |
| 180 | data: |
| 181 | title: 响应数据 |
| 182 | type: object |
| 183 | |
| 184 | DefaultApiDataResponse: |
| 185 | allOf: |
| 186 | - $ref: '#/components/schemas/ApiDataResponse' |
| 187 | - type: object |
| 188 | title: 响应 |
| 189 | properties: |
| 190 | data: |
| 191 | title: 响应数据 |
| 192 | type: object |
| 193 | |
| 194 | GrantedMenusResponse: |
| 195 | allOf: |
| 196 | - $ref: '#/components/schemas/DefaultApiDataResponse' |
| 197 | - type: object |
| 198 | title: 响应 |
| 199 | properties: |
| 200 | data: |
| 201 | allOf: |
| 202 | - $ref: '#/components/schemas/GrantedMenusResponseData' |