feat(openapi): 引入双层 OpenAPI 规范管理 (原始下游 & 包装层工具) 并升级版本至 v0.2.2
🚀 Release / 🚀 Build & Publish Multi-Platform Binaries (push) Has been cancelled
🚀 Release / 🚀 Build & Publish Multi-Platform Binaries (push) Has been cancelled
This commit is contained in:
1 parent
2dfcf67b00
commit
b13959451a
21 files changed
+1435
-12
No files matched your search
@@ -0,0 +1,130 @@
|
||||
ErrorResponse:
|
||||
type: object
|
||||
properties:
|
||||
error:
|
||||
type: boolean
|
||||
example: true
|
||||
message:
|
||||
type: string
|
||||
example: 操作失败原因
|
||||
|
||||
AuthLoginRequest:
|
||||
type: object
|
||||
required:
|
||||
- phone
|
||||
- password
|
||||
properties:
|
||||
phone:
|
||||
type: string
|
||||
description: 登录手机号
|
||||
example: "17718556446"
|
||||
password:
|
||||
type: string
|
||||
description: 登录明文密码 (由客户端自动完成 RSA 加密)
|
||||
autoSwitch:
|
||||
type: boolean
|
||||
description: 是否自动切换到首个企业
|
||||
default: true
|
||||
|
||||
AuthStatusResponse:
|
||||
type: object
|
||||
properties:
|
||||
loggedIn:
|
||||
type: boolean
|
||||
activeCorpId:
|
||||
type: string
|
||||
activeCorpName:
|
||||
type: string
|
||||
totalAccounts:
|
||||
type: integer
|
||||
totalCorps:
|
||||
type: integer
|
||||
|
||||
CorpConfig:
|
||||
type: object
|
||||
properties:
|
||||
corpId:
|
||||
type: string
|
||||
description: 企业唯一标识
|
||||
corpName:
|
||||
type: string
|
||||
description: 企业名称
|
||||
staffId:
|
||||
type: string
|
||||
description: 员工身份 ID
|
||||
accountId:
|
||||
type: string
|
||||
description: 归属账号手机号
|
||||
|
||||
PlatformItem:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: 自建应用 ID
|
||||
name:
|
||||
type: string
|
||||
description: 自建应用名称
|
||||
code:
|
||||
type: string
|
||||
description: 应用编码
|
||||
status:
|
||||
type: string
|
||||
description: 应用状态
|
||||
|
||||
WorkflowSummary:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: 工作流 ID
|
||||
name:
|
||||
type: string
|
||||
description: 工作流名称
|
||||
platformId:
|
||||
type: string
|
||||
description: 归属自建应用 ID
|
||||
platformName:
|
||||
type: string
|
||||
description: 归属自建应用名称
|
||||
state:
|
||||
type: integer
|
||||
description: "1: 启用, 0: 停用"
|
||||
updatedAt:
|
||||
type: string
|
||||
|
||||
WorkflowDetail:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
state:
|
||||
type: integer
|
||||
nodes:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
description: 工作流节点列表 (code-js2, loop, sql 等)
|
||||
links:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
|
||||
ProbeResult:
|
||||
type: object
|
||||
properties:
|
||||
corpId:
|
||||
type: string
|
||||
corpName:
|
||||
type: string
|
||||
mainSession:
|
||||
type: boolean
|
||||
description: 主站会话是否有效
|
||||
easoToken:
|
||||
type: boolean
|
||||
description: EASO 平台 Token 是否有效
|
||||
platformsReachable:
|
||||
type: boolean
|
||||
description: 自建应用接口是否可访问
|
||||
@@ -0,0 +1,46 @@
|
||||
openapi: 3.1.0
|
||||
info:
|
||||
title: hose-use API & MCP Tools Specification
|
||||
version: 0.2.2
|
||||
description: >-
|
||||
Unified Enterprise SaaS API, CLI, and MCP Specification for Ekuaibao (合思/易快报), EASO, and Piper Workflows.
|
||||
servers:
|
||||
- url: http://localhost:3000
|
||||
description: Local hose-use CLI / MCP Runtime Gateway
|
||||
tags:
|
||||
- name: Auth & SSO
|
||||
description: 统一认证、多账号管理与 30 天 Token 自动无感续杯
|
||||
- name: Corps & Tenancy
|
||||
description: 多企业租户管理与工作空间切换
|
||||
- name: Platforms
|
||||
description: 自建应用检索与实例枚举
|
||||
- name: Workflows
|
||||
description: 跨自建应用工作流聚合检索、DSL 图谱与启停
|
||||
- name: Probe & Diagnostics
|
||||
description: 会话有效性与 EASO 鉴权连通性诊断
|
||||
paths:
|
||||
/api/auth/login:
|
||||
$ref: ./paths/auth.yaml#/login
|
||||
/api/auth/status:
|
||||
$ref: ./paths/auth.yaml#/status
|
||||
/api/auth/refresh:
|
||||
$ref: ./paths/auth.yaml#/refresh
|
||||
/api/corps:
|
||||
$ref: ./paths/corps.yaml#/list
|
||||
/api/corps/switch:
|
||||
$ref: ./paths/corps.yaml#/switch
|
||||
/api/platforms:
|
||||
$ref: ./paths/platform.yaml#/list
|
||||
/api/workflows:
|
||||
$ref: ./paths/workflow.yaml#/list
|
||||
/api/workflows/find:
|
||||
$ref: ./paths/workflow.yaml#/find
|
||||
/api/workflows/{pipelineId}:
|
||||
$ref: ./paths/workflow.yaml#/detail
|
||||
/api/workflows/{pipelineId}/toggle:
|
||||
$ref: ./paths/workflow.yaml#/toggle
|
||||
/api/probe:
|
||||
$ref: ./paths/probe.yaml#/probe
|
||||
components:
|
||||
schemas:
|
||||
$ref: ./components/schemas/index.yaml
|
||||
@@ -0,0 +1,68 @@
|
||||
login:
|
||||
post:
|
||||
tags:
|
||||
- Auth & SSO
|
||||
summary: 纯 API 账密自动全流程登录
|
||||
description: 自动拉取公钥进行 RSA PKCS#1 加密,发起统一认证中心握手并批量获取名下所有企业身份。
|
||||
operationId: authLogin
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
$ref: ../components/schemas/index.yaml#/AuthLoginRequest
|
||||
responses:
|
||||
"200":
|
||||
description: 登录成功
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
totalCorps:
|
||||
type: integer
|
||||
activeCorp:
|
||||
$ref: ../components/schemas/index.yaml#/CorpConfig
|
||||
"401":
|
||||
description: 账密错误或鉴权失败
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
$ref: ../components/schemas/index.yaml#/ErrorResponse
|
||||
|
||||
status:
|
||||
get:
|
||||
tags:
|
||||
- Auth & SSO
|
||||
summary: 查看当前登录与活跃企业状态
|
||||
description: 查询本地或无状态下的当前账号、工作企业与凭证有效期。
|
||||
operationId: authStatus
|
||||
responses:
|
||||
"200":
|
||||
description: 状态正常
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
$ref: ../components/schemas/index.yaml#/AuthStatusResponse
|
||||
|
||||
refresh:
|
||||
post:
|
||||
tags:
|
||||
- Auth & SSO
|
||||
summary: 批量刷新企业 30 天 AccessToken
|
||||
description: 自动无感为当前账号名下的所有企业租户更新最新 30 天访问令牌。
|
||||
operationId: authRefresh
|
||||
responses:
|
||||
"200":
|
||||
description: 刷新完成
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
refreshed:
|
||||
type: integer
|
||||
total:
|
||||
type: integer
|
||||
@@ -0,0 +1,48 @@
|
||||
list:
|
||||
get:
|
||||
tags:
|
||||
- Corps & Tenancy
|
||||
summary: 列出当前账号名下所有已配置企业租户
|
||||
description: 支持单账号管理多家企业与同一企业下的多员工身份分层展示。
|
||||
operationId: listCorps
|
||||
responses:
|
||||
"200":
|
||||
description: 企业租户列表
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: ../components/schemas/index.yaml#/CorpConfig
|
||||
|
||||
switch:
|
||||
post:
|
||||
tags:
|
||||
- Corps & Tenancy
|
||||
summary: 切换当前工作企业
|
||||
description: 在有状态模式下切换并记忆工作企业,后续操作自动以该企业身份执行。
|
||||
operationId: switchCorp
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- corpId
|
||||
properties:
|
||||
corpId:
|
||||
type: string
|
||||
description: 目标企业 ID 或身份 ID (corpId@accountId)
|
||||
responses:
|
||||
"200":
|
||||
description: 切换成功
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
activeCorp:
|
||||
$ref: ../components/schemas/index.yaml#/CorpConfig
|
||||
@@ -0,0 +1,23 @@
|
||||
list:
|
||||
get:
|
||||
tags:
|
||||
- Platforms
|
||||
summary: 查询企业下所有启用的自建应用
|
||||
description: 枚举当前企业已配置的自建应用及 EASO 平台实例。
|
||||
operationId: listPlatforms
|
||||
parameters:
|
||||
- name: corpId
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
description: 目标企业 ID (未指定时使用默认工作企业)
|
||||
responses:
|
||||
"200":
|
||||
description: 自建应用列表
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: ../components/schemas/index.yaml#/PlatformItem
|
||||
@@ -0,0 +1,20 @@
|
||||
probe:
|
||||
get:
|
||||
tags:
|
||||
- Probe & Diagnostics
|
||||
summary: 诊断当前企业鉴权与接口连通性
|
||||
description: 依次校验企业主站 Session Cookie、EASO 换票握手与自建应用接口可访问性。
|
||||
operationId: probeCorp
|
||||
parameters:
|
||||
- name: corpId
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: 诊断报告
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
$ref: ../components/schemas/index.yaml#/ProbeResult
|
||||
@@ -0,0 +1,113 @@
|
||||
list:
|
||||
get:
|
||||
tags:
|
||||
- Workflows
|
||||
summary: 跨自建应用汇总查看全部工作流
|
||||
description: 自动遍历当前企业下所有自建应用,聚合返回全量工作流列表及运行状态。
|
||||
operationId: listAllWorkflows
|
||||
parameters:
|
||||
- name: corpId
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: 聚合工作流列表
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: ../components/schemas/index.yaml#/WorkflowSummary
|
||||
|
||||
find:
|
||||
get:
|
||||
tags:
|
||||
- Workflows
|
||||
summary: 按节点类型递归搜索工作流
|
||||
description: 递归解析所有工作流的 DSL 节点图谱,检索包含特定任务类型(如 code-js2, loop, sql 等)的工作流。
|
||||
operationId: findWorkflowsByTask
|
||||
parameters:
|
||||
- name: task
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: "code-js2"
|
||||
description: 目标节点任务类型
|
||||
- name: corpId
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: 匹配的工作流列表
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: ../components/schemas/index.yaml#/WorkflowSummary
|
||||
|
||||
detail:
|
||||
get:
|
||||
tags:
|
||||
- Workflows
|
||||
summary: 获取单个工作流详情与节点结构
|
||||
description: 查询指定工作流的完整节点链、输入输出参数映射与触发器配置。
|
||||
operationId: getWorkflowDetail
|
||||
parameters:
|
||||
- name: pipelineId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
description: 工作流 ID
|
||||
responses:
|
||||
"200":
|
||||
description: 工作流详情
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
$ref: ../components/schemas/index.yaml#/WorkflowDetail
|
||||
|
||||
toggle:
|
||||
put:
|
||||
tags:
|
||||
- Workflows
|
||||
summary: 启用或停用工作流
|
||||
description: "切换工作流的运行开关(1: 启用, 0: 停用)。"
|
||||
operationId: toggleWorkflow
|
||||
parameters:
|
||||
- name: pipelineId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- state
|
||||
properties:
|
||||
state:
|
||||
type: integer
|
||||
enum: [0, 1]
|
||||
description: "目标状态 (1=启用, 0=停用)"
|
||||
responses:
|
||||
"200":
|
||||
description: 状态切换成功
|
||||
content:
|
||||
"application/json":
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
state:
|
||||
type: integer
|
||||
Reference in new issue
Block a user