Skip to content

Commit c24cf62

Browse files
committed
Merge branch 'feat/support_plugin_format_template' into develop
2 parents 5382bc3 + 124144e commit c24cf62

File tree

7 files changed

+2791
-1707
lines changed

7 files changed

+2791
-1707
lines changed

bkflow/apigw/docs/zh/get_template_detail.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
| 字段 | 类型 | 必选 | 描述 |
1414
|-----------------|--------|----|----------------------------------------------------------------------------------------------------------------------------------------------|
1515
| with_mock_data | bool || 是否一起返回 mock 数据,默认为 false。 当设置为 true 时,返回数据中会增加 appoint_node_ids 和 mock_data 两个字段,且如果 appoint_node_ids 有指定 mock 执行节点时,pipeline_tree 会进行对应的精简。 |
16+
| format | string || 返回数据格式,可选值:raw(默认,原始格式)、pipeline_tree(流程树格式,与raw相同)、plugin(插件格式)。当传入 plugin 时,返回插件格式的数据结构。 |
1617

1718

1819
路径参数:
@@ -131,4 +132,93 @@
131132
| update_by | string | 流程更新人 |
132133
| update_at | datetime | 更新时间 |
133134
| appoint_node_ids | list | 当 with_mock_data 传参为 true 时返回,mock 执行时选中的节点 ID 列表 |
134-
| mock_data | list | 当 with_mock_data 传参为 true 时返回,每个元素包含 node_id,data 和 is_default |
135+
| mock_data | list | 当 with_mock_data 传参为 true 时返回,每个元素包含 node_id,data 和 is_default |
136+
137+
### format=plugin 时的返回示例
138+
139+
当 format 参数传入 plugin 时,返回插件格式的数据结构:
140+
141+
```json
142+
{
143+
"result": true,
144+
"data": {
145+
"id": 3,
146+
"name": "测试模板",
147+
"desc": "模板描述信息",
148+
"version": "1.0.0",
149+
"space_id": 2,
150+
"scope_type": null,
151+
"scope_value": null,
152+
"creator": "admin",
153+
"create_at": "2024-01-01T00:00:00Z",
154+
"updated_by": "admin",
155+
"update_at": "2024-01-02T00:00:00Z",
156+
"inputs": {
157+
"type": "object",
158+
"properties": {
159+
"param1": {
160+
"title": "参数1",
161+
"type": "string"
162+
}
163+
},
164+
"required": ["param1"],
165+
"definitions": {}
166+
},
167+
"outputs": {
168+
"type": "object",
169+
"properties": {
170+
"output1": {
171+
"title": "输出1",
172+
"type": "string"
173+
}
174+
},
175+
"required": ["output1"],
176+
"definitions": {}
177+
},
178+
"context_inputs": {
179+
"type": "object",
180+
"properties": {
181+
"executor": {
182+
"title": "任务执行人",
183+
"type": "string"
184+
},
185+
"task_name": {
186+
"title": "任务名称",
187+
"type": "string"
188+
},
189+
"task_id": {
190+
"title": "任务ID",
191+
"type": "string"
192+
},
193+
"task_space_id": {
194+
"title": "任务空间ID",
195+
"type": "string"
196+
}
197+
},
198+
"required": ["executor", "task_name", "task_id", "task_space_id"],
199+
"definitions": {}
200+
}
201+
},
202+
"code": 0,
203+
"trace_id": "xxxxxxxxx"
204+
}
205+
```
206+
207+
### format=plugin 时 data 字段说明
208+
209+
| 字段 | 类型 | 描述 |
210+
|----------------------|--------|-------------------------------------------|
211+
| id | int | 流程 ID |
212+
| name | string | 流程名称 |
213+
| desc | string | 流程描述 |
214+
| version | string | 流程版本号 |
215+
| space_id | int | 空间 ID |
216+
| scope_type | string | 流程所属作用域类型 |
217+
| scope_value | string | 流程所属作用域值 |
218+
| creator | string | 创建人 |
219+
| create_at | datetime | 创建时间 |
220+
| updated_by | string | 更新人 |
221+
| update_at | datetime | 更新时间 |
222+
| inputs | object | 输入参数 JSON Schema,从 pipeline_tree 解析 |
223+
| outputs | object | 输出参数 JSON Schema,从 pipeline_tree 解析 |
224+
| context_inputs | object | 上下文输入参数 JSON Schema |

bkflow/apigw/docs/zh/get_template_detail_by_app.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
| 字段 | 类型 | 必选 | 描述 |
1919
|-----------------|--------|----|----------------------------------------------------------------------------------------------------------------------------------------------|
2020
| with_mock_data | bool || 是否一起返回 mock 数据,默认为 false。 当设置为 true 时,返回数据中会增加 appoint_node_ids 和 mock_data 两个字段,且如果 appoint_node_ids 有指定 mock 执行节点时,pipeline_tree 会进行对应的精简。 |
21+
| format | string || 返回数据格式,可选值:raw(默认,原始格式)、pipeline_tree(流程树格式,与raw相同)、plugin(插件格式)。当传入 plugin 时,返回插件格式的数据结构。 |
2122

2223

2324
路径参数:
@@ -133,3 +134,74 @@ bk_app_code 不匹配:
133134
| appoint_node_ids | list | 当 with_mock_data 传参为 true 时返回,mock 执行时选中的节点 ID 列表 |
134135
| mock_data | list | 当 with_mock_data 传参为 true 时返回,每个元素包含 node_id,data 和 is_default |
135136

137+
### format=plugin 时的返回示例
138+
139+
当 format 参数传入 plugin 时,返回插件格式的数据结构:
140+
141+
```json
142+
{
143+
"result": true,
144+
"data": {
145+
"desc": "插件描述信息",
146+
"version": "0.0.1",
147+
"enable_plugin_callback": true,
148+
"inputs": {
149+
"type": "object",
150+
"properties": {
151+
"param1": {
152+
"title": "参数1",
153+
"type": "string"
154+
}
155+
},
156+
"required": ["param1"],
157+
"definitions": {}
158+
},
159+
"outputs": {
160+
"type": "object",
161+
"properties": {
162+
"output1": {
163+
"title": "输出1",
164+
"type": "string"
165+
}
166+
},
167+
"required": ["output1"],
168+
"definitions": {}
169+
},
170+
"context_inputs": {
171+
"type": "object",
172+
"properties": {
173+
"executor": {
174+
"title": "任务执行人",
175+
"type": "string"
176+
}
177+
},
178+
"required": ["executor"],
179+
"definitions": {}
180+
},
181+
"forms": {
182+
"renderform": "(function () { ... })();"
183+
},
184+
"app": {
185+
"url": "http://example.com/",
186+
"urls": ["http://example.com/"],
187+
"name": "示例应用",
188+
"code": "example-app"
189+
}
190+
},
191+
"code": 0,
192+
"trace_id": "xxxxxxxxx"
193+
}
194+
```
195+
196+
### format=plugin 时 data 字段说明
197+
198+
| 字段 | 类型 | 描述 |
199+
|----------------------|--------|-------------------------------------------|
200+
| desc | string | 插件描述信息 |
201+
| version | string | 插件版本号 |
202+
| enable_plugin_callback | bool | 是否启用插件回调 |
203+
| inputs | object | 插件输入参数 JSON Schema |
204+
| outputs | object | 插件输出参数 JSON Schema |
205+
| context_inputs | object | 插件上下文输入参数 JSON Schema |
206+
| forms | object | 表单配置,包含 renderform 字段 |
207+
| app | object | 应用信息,包含 url、urls、name、code 等字段 |

0 commit comments

Comments
 (0)