Skip to content

Commit 44da939

Browse files
committed
docs(rest): rule schema API
Signed-off-by: Jiyong Huang <huangjy@emqx.io>
1 parent 7fb1993 commit 44da939

File tree

4 files changed

+62
-1
lines changed

4 files changed

+62
-1
lines changed

docs/en_US/api/restapi/rules.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,32 @@ Response Sample:
7474
}
7575
```
7676

77+
## get schema of a rule
78+
79+
This API allows you to retrieve the output schema of a specific rule. The schema describes the fields and their
80+
properties (like hasIndex and index) that are produced by the rule's SELECT statement.
81+
82+
```shell
83+
GET http://localhost:9081/rules/{id}
84+
```
85+
86+
Path parameter `id` is the id of the rule.
87+
88+
Example response when using slice mode:
89+
90+
```json
91+
{
92+
"id": {
93+
"hasIndex": true,
94+
"index": 0
95+
},
96+
"name": {
97+
"hasIndex": true,
98+
"index": 1
99+
}
100+
}
101+
```
102+
77103
## update a rule
78104

79105
The API accepts a JSON content and update a rule.

docs/en_US/api/restapi/streams.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Response Sample:
8686
}
8787
```
8888

89-
## Get stream schema
89+
## get stream schema
9090

9191
The API is used to get the stream schema. The schema is inferred from the physical and logical schema definitions.
9292

@@ -127,6 +127,9 @@ The format is like Json schema:
127127
}
128128
```
129129

130+
For a shared stream, the schema adjusts dynamically during runtime according to the active processing rules. To reduce
131+
computational overhead, the system maintains only the minimal schema needed to support those rules.
132+
130133
## update a stream
131134

132135
The API is used for update the stream definition.

docs/zh_CN/api/restapi/rules.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,36 @@ GET http://localhost:9081/rules/{id}
7474
}
7575
```
7676

77+
### 中文技术文档翻译(符合API文档规范)
78+
79+
---
80+
81+
## 获取规则输出模式
82+
83+
本接口用于获取指定规则生成的输出模式。该模式描述了规则通过SELECT语句生成的字段及其属性(如`hasIndex``index`)。
84+
85+
```shell
86+
GET http://localhost:9081/rules/{id}
87+
```
88+
89+
**路径参数**
90+
`id` : 规则唯一标识符
91+
92+
**示例响应**
93+
94+
```json
95+
{
96+
"id": {
97+
"hasIndex": true,
98+
"index": 0
99+
},
100+
"name": {
101+
"hasIndex": true,
102+
"index": 1
103+
}
104+
}
105+
```
106+
77107
## 更新规则
78108

79109
该 API 接受 JSON 内容并更新规则。

docs/zh_CN/api/restapi/streams.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ GET http://localhost:9081/streams/{id}/schema
108108
}
109109
```
110110

111+
对于共享数据流,其模式会根据运行时生效的处理规则进行动态调整。为降低计算开销,系统仅维护支持当前规则所需的最小化模式。
112+
111113
## 更新流
112114

113115
该 API 用于更新流定义。

0 commit comments

Comments
 (0)