-
Notifications
You must be signed in to change notification settings - Fork 1
/
governance-schema.json
193 lines (193 loc) · 4.69 KB
/
governance-schema.json
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
{
"$schema": "https://json-schema.org/draft-07/schema",
"title": "VIP governance rules JSON schema",
"definitions": {
"allowedFeaturesArray": {
"description": "Array of allowed features for this rule. Supported features are: codeEditor and lockBlocks",
"type": "array",
"items": {
"type": "string",
"enum": [ "codeEditor", "lockBlocks" ]
},
"uniqueItems": true,
"examples": [ [ "codeEditor", "lockBlocks" ] ]
},
"allowedBlocksArray": {
"description": "Array of allowed blocks for this rule. Blocks can contain asterisks for pattern matching.",
"type": "array",
"items": [
{
"type": "string",
"examples": [ "*", "core/*", "core/paragraph", "core/heading" ]
}
]
},
"blockSettingsProperties": {
"description": "Block settings for block or nested inner block types",
"type": "object",
"properties": {
"allowedBlocks": {
"$ref": "#/definitions/allowedBlocksArray"
}
},
"patternProperties": {
"^[a-z][a-z0-9-]*/[a-z][a-z0-9-]*$": {
"$ref": "#/definitions/blockSettingsProperties"
},
"^[a-z][a-z0-9-]*/[*]$": {
"$ref": "#/definitions/blockSettingsProperties"
}
}
},
"ruleBlockSettingsProperties": {
"description": "Theme.json block settings for this rule. Allows block nesting and allowedBlocks array.",
"type": "object",
"patternProperties": {
"^[a-z][a-z0-9-]*/[a-z][a-z0-9-]*$": {
"$ref": "#/definitions/blockSettingsProperties"
},
"^[a-z][a-z0-9-]*/[*]$": {
"$ref": "#/definitions/blockSettingsProperties"
}
},
"additionalProperties": false,
"examples": [
{
"core/paragraph": {
"color": {
"gradients": [
{
"slug": "vertical-red-to-green",
"gradient": "linear-gradient(to bottom,#ff0000 0%,#00FF00 100%)",
"name": "Vertical red to green"
}
]
}
},
"core/*": {
"color": {
"text": false
}
},
"core/quote": {
"allowedBlocks": [ "core/paragraph", "core/heading" ]
},
"core/media-text": {
"core/heading": {
"typography": {
"customFontSize": false
}
}
}
}
]
},
"ruleDefaultProperties": {
"type": "object",
"properties": {
"type": {
"description": "Default rule - applies additively to all users.",
"type": "string",
"enum": [ "default" ]
},
"allowedFeatures": {
"$ref": "#/definitions/allowedFeaturesArray"
},
"allowedBlocks": {
"$ref": "#/definitions/allowedBlocksArray"
},
"blockSettings": {
"$ref": "#/definitions/ruleBlockSettingsProperties"
}
},
"required": [ "type" ],
"additionalProperties": false
},
"ruleRoleProperties": {
"type": "object",
"properties": {
"type": {
"description": "Role rule - applies to one or more specific roles.",
"type": "string",
"enum": [ "role" ]
},
"roles": {
"type": "array",
"items": {
"type": "string"
},
"examples": [ [ "administrator", "editor" ] ],
"minItems": 1
},
"allowedFeatures": {
"$ref": "#/definitions/allowedFeaturesArray"
},
"allowedBlocks": {
"$ref": "#/definitions/allowedBlocksArray"
},
"blockSettings": {
"$ref": "#/definitions/ruleBlockSettingsProperties"
}
},
"required": [ "type", "roles" ],
"additionalProperties": false
},
"rulePostTypeProperties": {
"type": "object",
"properties": {
"type": {
"description": "Post Type rule - applies to one or more specific post types.",
"type": "string",
"enum": [ "postType" ]
},
"postTypes": {
"type": "array",
"items": {
"type": "string"
},
"examples": [ [ "page", "post" ] ],
"minItems": 1
},
"allowedFeatures": {
"$ref": "#/definitions/allowedFeaturesArray"
},
"allowedBlocks": {
"$ref": "#/definitions/allowedBlocksArray"
},
"blockSettings": {
"$ref": "#/definitions/ruleBlockSettingsProperties"
}
},
"required": [ "type", "postTypes" ],
"additionalProperties": false
}
},
"type": "object",
"default": {},
"required": [ "rules", "version" ],
"properties": {
"$schema": {
"description": "JSON schema URI for governance JSON",
"type": "string"
},
"version": {
"description": "Version of governance JSON",
"type": "string",
"enum": [ "1.0.0" ]
},
"rules": {
"description": "Array of governance rules",
"type": "array",
"default": [],
"items": {
"type": "object",
"oneOf": [
{ "$ref": "#/definitions/ruleDefaultProperties" },
{ "$ref": "#/definitions/ruleRoleProperties" },
{ "$ref": "#/definitions/rulePostTypeProperties" }
]
}
}
},
"additionalProperties": false
}