-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.go
135 lines (133 loc) · 7.54 KB
/
schema.go
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package main
const RuleSetSchema = `{
"$schema": "https://json-schema.org/draft-07/schema#",
"title": "Linter Rules",
"description": "Rules for validating Genesys Cloud Developer Center content.",
"type": "object",
"properties": {
"name": {
"description": "Name of the rule configuration",
"type": "string"
},
"description": {
"description": "Description of the rule configuration",
"type": "string"
},
"ruleGroups": {
"description": "Groups of rules based on common aspect of validation.",
"type": "object",
"patternProperties": {
"^[A-Z]+$":{
"description": "ID of the rule group. This will also be the prefix for the specific rules's id.",
"type": "object",
"properties": {
"description": {
"description": "Description of the rule group.",
"type": "string"
},
"rules": {
"description": "Rules for validation",
"type": "object",
"patternProperties": {
"[0-9]+": {
"description": "Defines the rule to validate",
"type": "object",
"properties": {
"description": {
"description": "Description of the rule.",
"type": "string"
},
"path": {
"description": "Path for the file/folder to be evaluated.",
"type": "string",
"pattern": "^(.+)/([^/]+)$"
},
"files": {
"description": "Array of files/folder to be evaluated.",
"type": "array",
"items": {
"type": "string"
}
},
"conditions": {
"description": "Array of conditions to evaluate against. All conditions must pass for the rule to pass.",
"type": "array",
"items": {
"description": "A condition to evaluate on the rule.",
"type": "object",
"properties": {
"pathExists": {
"description": "Check whether the path(file/folder) exists. Setting this to false does not have an effect.",
"enum": [true]
},
"contains": {
"description": "Checks the plaintext file if it contains a specific value.",
"type": "array",
"items": {
"description": "Definition for content to find",
"type": "object",
"properties": {
"type": {
"description": "Valid: static, regex",
"enum": ["static", "regex"]
},
"value": {
"type": "string"
}
},
"required": ["type", "value"]
}
},
"notContains": {
"description": "Checks the plaintext file that nothing matches the regex pattern.",
"type": "array",
"items": {
"type": "string"
}
},
"checkReferenceExist": {
"description": "Checks if the path(file/folder) exists in the blueprints",
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false
},
"minItems": 1
},
"level": {
"description": "Severity level of the rule. Valid: ['warning', 'error']",
"enum": ["warning", "error"]
}
},
"required": ["description", "conditions", "level"],
"oneOf": [{
"required": ["files"],
"properties": {
"path": false
}
}, {
"required": ["path"],
"properties": {
"files": false
}
}],
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"required": ["rules"],
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"required": ["name", "description", "ruleGroups"],
"additionalProperties": false
}
`