1
|
{
|
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
3
|
"$id": "https://hydrilla.koszko.org/schemas/common_definitions-2.schema.json",
|
4
|
"title": "Common definitions",
|
5
|
"description": "Definitions used by other Hydrilla schemas",
|
6
|
"definitions": {
|
7
|
"version": {
|
8
|
"description": "Version expressed as an array of integers",
|
9
|
"type": "array",
|
10
|
"minItems": 1,
|
11
|
"items": {
|
12
|
"type": "integer",
|
13
|
"minimum": 0
|
14
|
},
|
15
|
"contains": {
|
16
|
"type": "integer",
|
17
|
"minimum": 1
|
18
|
},
|
19
|
"minItems": 1
|
20
|
},
|
21
|
"source_name": {
|
22
|
"description": "Unique identifier of this source package",
|
23
|
"type": "string",
|
24
|
"pattern": "^[-0-9a-z.]+$"
|
25
|
},
|
26
|
"comment": {
|
27
|
"description": "An optional comment",
|
28
|
"type": "string"
|
29
|
},
|
30
|
"file_ref_list": {
|
31
|
"description": "List of simple file references",
|
32
|
"type": "array",
|
33
|
"items": {
|
34
|
"type": "object",
|
35
|
"required": ["file"],
|
36
|
"properties": {
|
37
|
"file": {
|
38
|
"description": "Filename relative to source package main directory; separator is '/'",
|
39
|
"type": "string",
|
40
|
"pattern": "^[^/]"
|
41
|
}
|
42
|
}
|
43
|
}
|
44
|
},
|
45
|
"sha256": {
|
46
|
"description": "An SHA256 sum, in hexadecimal",
|
47
|
"type": "string",
|
48
|
"pattern": "^[0-9a-f]{64}$"
|
49
|
},
|
50
|
"file_ref_list_sha256": {
|
51
|
"description": "List of file references with files' SHA256 sums included",
|
52
|
"allOf": [{
|
53
|
"$ref": "#/definitions/file_ref_list"
|
54
|
}, {
|
55
|
"type": "array",
|
56
|
"items": {
|
57
|
"type": "object",
|
58
|
"required": ["sha256"],
|
59
|
"properties": {
|
60
|
"sha256": {
|
61
|
"$ref": "#/definitions/sha256"
|
62
|
}
|
63
|
}
|
64
|
}
|
65
|
}]
|
66
|
},
|
67
|
"item_identifier": {
|
68
|
"description": "Identifier of an item (shared with other versions of the item, otherwise unique)",
|
69
|
"type": "string",
|
70
|
"pattern": "^[-0-9a-z]+$"
|
71
|
},
|
72
|
"item_dep_specifier": {
|
73
|
"description": "Simple reference to an item as a dependency",
|
74
|
"type": "object",
|
75
|
"required": ["identifier"],
|
76
|
"properties": {
|
77
|
"identifier": {
|
78
|
"$ref": "#/definitions/item_identifier"
|
79
|
}
|
80
|
}
|
81
|
},
|
82
|
"item_dep_specifier_array": {
|
83
|
"description": "Array of references to items as dependencies",
|
84
|
"type": "array",
|
85
|
"items": {
|
86
|
"$ref": "#/definitions/item_dep_specifier"
|
87
|
}
|
88
|
},
|
89
|
"item_ref": {
|
90
|
"description": "An object containing a subset of fields from full item definition",
|
91
|
"type": "object",
|
92
|
"required": ["identifier", "long_name", "version"],
|
93
|
"properties": {
|
94
|
"identifier": {
|
95
|
"$ref": "#/definitions/item_identifier"
|
96
|
},
|
97
|
"long_name": {
|
98
|
"description": "User-friendly alternative to the identifier",
|
99
|
"type": "string"
|
100
|
},
|
101
|
"version": {
|
102
|
"$ref": "#/definitions/version"
|
103
|
}
|
104
|
}
|
105
|
},
|
106
|
"typed_item_ref": {
|
107
|
"description": "An object containing a subset of fields from full item definition, including type",
|
108
|
"allOf": [{
|
109
|
"$ref": "#/definitions/item_ref"
|
110
|
}, {
|
111
|
"type": "object",
|
112
|
"required": ["type"],
|
113
|
"properties": {
|
114
|
"type": {
|
115
|
"description": "What kind of item is it (resource or mapping)",
|
116
|
"enum": ["resource", "mapping"]
|
117
|
}
|
118
|
}
|
119
|
}]
|
120
|
},
|
121
|
"item_definition_base": {
|
122
|
"description": "Definition of a resource/mapping (fields common to source definitions and built definitions)",
|
123
|
"allOf": [{
|
124
|
"$ref": "#/definitions/item_ref"
|
125
|
}, {
|
126
|
"type": "object",
|
127
|
"required": ["description"],
|
128
|
"properties": {
|
129
|
"uuid": {
|
130
|
"description": "UUIDv4 of this item (shared with other versions of this item, otherwise unique)",
|
131
|
"type": "string",
|
132
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
|
133
|
},
|
134
|
"description": {
|
135
|
"description": "Item's description",
|
136
|
"type": "string"
|
137
|
},
|
138
|
"min_haketilo_version": {
|
139
|
"description": "Specify that this item should not be used with Haketilo versions older than specified here",
|
140
|
"$ref": "#/definitions/version",
|
141
|
"default": [1]
|
142
|
},
|
143
|
"max_haketilo_version": {
|
144
|
"description": "Specify that this item should not be used with Haketilo versions newer than specified here",
|
145
|
"$ref": "#/definitions/version",
|
146
|
"default": [65536]
|
147
|
},
|
148
|
"permissions": {
|
149
|
"description": "What privileges should be granted on pages where this resource/mapping is used",
|
150
|
"type": "object",
|
151
|
"properties": {
|
152
|
"cors_bypass": {
|
153
|
"description": "Specify if a page should be allowed to perform cross-origin requests",
|
154
|
"type": "boolean",
|
155
|
"default": false
|
156
|
},
|
157
|
"eval": {
|
158
|
"description": "Specify if scripts added to the page should be allowed to use eval() (and related mechanisms)",
|
159
|
"type": "boolean",
|
160
|
"default": false
|
161
|
}
|
162
|
}
|
163
|
},
|
164
|
"required_mappings": {
|
165
|
"description": "Which mappings this item requires to be enabled",
|
166
|
"$ref": "#/definitions/item_dep_specifier_array",
|
167
|
"default": []
|
168
|
},
|
169
|
"comment": {
|
170
|
"$ref": "#/definitions/comment"
|
171
|
}
|
172
|
}
|
173
|
}]
|
174
|
},
|
175
|
"resource_definition_base": {
|
176
|
"description": "Definition of a resource (fields common to source definitions and built definitions)",
|
177
|
"allOf": [{
|
178
|
"$ref": "#/definitions/item_definition_base"
|
179
|
}, {
|
180
|
"type": "object",
|
181
|
"required": ["type", "revision"],
|
182
|
"properties": {
|
183
|
"revision": {
|
184
|
"description": "Which revision of a packaging of given version of an upstream resource is this",
|
185
|
"type": "integer",
|
186
|
"minimum": 1
|
187
|
},
|
188
|
"scripts": {
|
189
|
"description": "What scripts are included in the resource",
|
190
|
"$ref": "#/definitions/file_ref_list",
|
191
|
"default": []
|
192
|
}
|
193
|
}
|
194
|
}]
|
195
|
},
|
196
|
"mapping_definition_base": {
|
197
|
"description": "Definition of a mapping (fields common to source definitions and built definitions)",
|
198
|
"allOf": [{
|
199
|
"$ref": "#/definitions/item_definition_base"
|
200
|
}, {
|
201
|
"type": "object",
|
202
|
"properties": {
|
203
|
"payloads": {
|
204
|
"description": "Which payloads are to be applied to which URLs",
|
205
|
"additionalProperties": {
|
206
|
"$ref": "#/definitions/item_dep_specifier"
|
207
|
},
|
208
|
"default": {},
|
209
|
"examples": [{
|
210
|
"https://hydrillabugs.koszko.org/***": {
|
211
|
"identifier": "helloapple"
|
212
|
},
|
213
|
"https://*.koszko.org/***": {
|
214
|
"identifier": "hello-potato"
|
215
|
}
|
216
|
}]
|
217
|
}
|
218
|
}
|
219
|
}]
|
220
|
},
|
221
|
"generated_by": {
|
222
|
"description": "Describe what software generated this instance",
|
223
|
"type": "object",
|
224
|
"required": ["name"],
|
225
|
"properties": {
|
226
|
"name": {
|
227
|
"type": "string",
|
228
|
"description": "Instance generator software name, without version"
|
229
|
},
|
230
|
"version": {
|
231
|
"type": "string",
|
232
|
"description": "Instance generator software version, in arbitrary format"
|
233
|
}
|
234
|
}
|
235
|
},
|
236
|
"item_definition": {
|
237
|
"description": "Definition of a resource/mapping (fields specific to built definitions)",
|
238
|
"type": "object",
|
239
|
"required": ["source_name", "source_copyright"],
|
240
|
"properties": {
|
241
|
"source_name": {
|
242
|
"$ref": "#/definitions/source_name"
|
243
|
},
|
244
|
"source_copyright": {
|
245
|
"description": "Which files indicate license terms of the source package and should be installed",
|
246
|
"$ref": "#/definitions/file_ref_list_sha256"
|
247
|
},
|
248
|
"generated_by": {
|
249
|
"$ref": "#/definitions/generated_by"
|
250
|
}
|
251
|
}
|
252
|
}
|
253
|
}
|
254
|
}
|