# 查看节点当前测试规则

# 调用方式: GET

# 接口地址:

https://api.freelog.com/v2/testNodes/{nodeId}/rules
1

# 返回说明:

返回值字段 字段类型 字段说明
userId int 创建方案的用户ID
nodeId int 节点ID
ruleText string 规则文本
status int 匹配状态1:匹配中 2:匹配失败 3:匹配成功
testRules object[] 测试规则集合
** id string 规则ID
** text string 规则原文
** matchErrors string[] 规则匹配时的错误信息
** ruleInfo object 规则具体信息(见下面ruleInfo实体说明)
** efficientInfos object[] 匹配生效次数
** operations string[] 规则对应的操作类型,包含add,alter,activate_theme,set_labels,online,replace,add_attr,delete_attr,set_cover,set_title
**** count int 生效次数

# 实体ruleInfo说明:

返回值字段 字段类型 字段说明
operation string 操作类型,包含add,alter,activate_theme
labels string[] add资源或者set时,设置的标签
online bool? 是否上线,null值表示未设置
exhibitName string 指定作用的测试资源名称
candidate object add资源时的候选目标对象信息
** name string 候选资源或对象名称
** type string 候选目标类型,object或resource
** versionRange string 候选目标的版本范围,对象无此属性
replaces object[] 替换信息对象集合
** replaced object replace时的被替代者信息
**** name string 被替代者名称
**** type string 被替代者类型
**** versionRange string 被替代者版本范围
** replacer object replace时的替代者信息
**** name string 替代者名称
**** type string 替代者类型
**** versionRange string 替代者版本范围
** scopes object [] 替换操作时的作用范围
**** name string 上游依赖树节点的资源名称
**** type string 上游依赖树节点资源类型
**** versionRange string 上游依赖树节点资源版本范围

# 返回示例

{
	"ret": 0,
	"errCode": 0,
	"errcode": 0,
	"msg": "success",
	"data": {
		"ruleText": "add  $yuliang/风景图 as import_test_resource\ndo\n   set_labels tag1,tag2,tag3\t\t\nend\nadd   #yuliang-a/yuliang-4131  as object_1 \ndo  \n   set_labels reset  \n   replace #yuliang/readme2 with #yuliang/readme3  \n   hide \nend",
		"themeId": "",
		"status": 3,
		"matchResultDate": "2021-01-22T03:39:57.110Z",
		"_id": "600500e24bb9f4472c872868",
		"nodeId": 80000000,
		"userId": 50021,
		"testRules": [{
			"matchErrors": [],
			"efficientInfos": [{
				"type": "add",
				"count": 1
			}, {
				"type": "setTags",
				"count": 1
			}],
			"id": "c91c561bb160c49f067fbb8435d5d3dc",
			"ruleInfo": {
				"text": "add  $yuliang/风景图 as import_test_resource\ndo\n   set_labels tag1,tag2,tag3\t\t\nend",
				"operation": "add",
				"candidate": {
					"name": "yuliang/风景图",
					"versionRange": "latest",
					"type": "resource"
				},
				"exhibitName": "import_test_resource",
				"labels": ["tag1", "tag2", "tag3"]
			}
		}, {
			"matchErrors": ["名称为yuliang-a/yuliang-4131的存储对象暂未设置资源类型,无法被使用"],
			"efficientInfos": [],
			"id": "d637ffc311a35f04f488682c05adf9c9",
			"ruleInfo": {
				"text": "add   #yuliang-a/yuliang-4131  as object_1 \ndo  \n   set_labels reset  \n   replace #yuliang/readme2 with #yuliang/readme3  \n   hide \nend",
				"operation": "add",
				"candidate": {
					"name": "yuliang-a/yuliang-4131",
					"type": "object"
				},
				"exhibitName": "object_1",
				"labels": ["reset"],
				"replaces": [{
					"replaced": {
						"name": "yuliang/readme2",
						"type": "object"
					},
					"replacer": {
						"name": "yuliang/readme3",
						"type": "object"
					},
					"scopes": []
				}],
				"online": false
			}
		}],
		"createDate": "2021-01-18T03:30:42.099Z",
		"updateDate": "2021-01-22T03:39:57.112Z"
	}
}
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65