1
|
{
|
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
3
|
"$id": "https://hydrilla.koszko.org/schemas/common_definitions-1.0.1.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_ref": {
|
83
|
"description": "An object containing a subset of fields from full item definition",
|
84
|
"type": "object",
|
85
|
"required": ["identifier", "long_name", "version"],
|
86
|
"properties": {
|
87
|
"identifier": {
|
88
|
"$ref": "#/definitions/item_identifier"
|
89
|
},
|
90
|
"long_name": {
|
91
|
"description": "User-friendly alternative to the identifier",
|
92
|
"type": "string"
|
93
|
},
|
94
|
"version": {
|
95
|
"$ref": "#/definitions/version"
|
96
|
}
|
97
|
}
|
98
|
},
|
99
|
"typed_item_ref": {
|
100
|
"description": "An object containing a subset of fields from full item definition, including type",
|
101
|
"allOf": [{
|
102
|
"$ref": "#/definitions/item_ref"
|
103
|
}, {
|
104
|
"type": "object",
|
105
|
"required": ["type"],
|
106
|
"properties": {
|
107
|
"type": {
|
108
|
"description": "What kind of item is it (resource or mapping)",
|
109
|
"enum": ["resource", "mapping"]
|
110
|
}
|
111
|
}
|
112
|
}]
|
113
|
},
|
114
|
"item_definition_base": {
|
115
|
"description": "Definition of a resource/mapping (fields common to source definitions and built definitions)",
|
116
|
"allOf": [{
|
117
|
"$ref": "#/definitions/typed_item_ref"
|
118
|
}, {
|
119
|
"type": "object",
|
120
|
"required": ["description"],
|
121
|
"properties": {
|
122
|
"uuid": {
|
123
|
"description": "UUIDv4 of this item (shared with other versions of this item, otherwise unique)",
|
124
|
"type": "string",
|
125
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
|
126
|
},
|
127
|
"description": {
|
128
|
"description": "Item's description",
|
129
|
"type": "string"
|
130
|
},
|
131
|
"comment": {
|
132
|
"$ref": "#/definitions/comment"
|
133
|
}
|
134
|
}
|
135
|
}]
|
136
|
},
|
137
|
"resource_definition_base": {
|
138
|
"description": "Definition of a resource (fields common to source definitions and built definitions)",
|
139
|
"allOf": [{
|
140
|
"$ref": "#/definitions/item_definition_base"
|
141
|
}, {
|
142
|
"type": "object",
|
143
|
"required": ["type", "revision"],
|
144
|
"properties": {
|
145
|
"type": {
|
146
|
"description": "Identify this item as a resource",
|
147
|
"const": "resource"
|
148
|
},
|
149
|
"revision": {
|
150
|
"description": "Which revision of a packaging of given version of an upstream resource is this",
|
151
|
"type": "integer",
|
152
|
"minimum": 1
|
153
|
},
|
154
|
"scripts": {
|
155
|
"description": "What scripts are included in the resource",
|
156
|
"$ref": "#/definitions/file_ref_list",
|
157
|
"default": []
|
158
|
},
|
159
|
"dependencies": {
|
160
|
"description": "Which other resources this resource depends on",
|
161
|
"type": "array",
|
162
|
"items": {
|
163
|
"$ref": "#/definitions/item_dep_specifier"
|
164
|
},
|
165
|
"default": []
|
166
|
}
|
167
|
}
|
168
|
}]
|
169
|
},
|
170
|
"mapping_definition_base": {
|
171
|
"description": "Definition of a mapping (fields common to source definitions and built definitions)",
|
172
|
"allOf": [{
|
173
|
"$ref": "#/definitions/item_definition_base"
|
174
|
}, {
|
175
|
"type": "object",
|
176
|
"required": ["type"],
|
177
|
"properties": {
|
178
|
"type": {
|
179
|
"description": "Identify this item as a mapping",
|
180
|
"const": "mapping"
|
181
|
},
|
182
|
"payloads": {
|
183
|
"description": "Which payloads are to be applied to which URLs",
|
184
|
"additionalProperties": {
|
185
|
"$ref": "#/definitions/item_dep_specifier"
|
186
|
},
|
187
|
"default": {},
|
188
|
"examples": [{
|
189
|
"https://hydrillabugs.koszko.org/***": {
|
190
|
"identifier": "helloapple"
|
191
|
},
|
192
|
"https://*.koszko.org/***": {
|
193
|
"identifier": "hello-potato"
|
194
|
}
|
195
|
}]
|
196
|
}
|
197
|
}
|
198
|
}]
|
199
|
},
|
200
|
"generated_by": {
|
201
|
"description": "Describe what software generated this instance",
|
202
|
"type": "object",
|
203
|
"required": ["name"],
|
204
|
"properties": {
|
205
|
"name": {
|
206
|
"type": "string",
|
207
|
"description": "Instance generator software name, without version"
|
208
|
},
|
209
|
"version": {
|
210
|
"type": "string",
|
211
|
"description": "Instance generator software version, in arbitrary format"
|
212
|
}
|
213
|
}
|
214
|
},
|
215
|
"item_definition": {
|
216
|
"description": "Definition of a resource/mapping (fields specific to built definitions)",
|
217
|
"type": "object",
|
218
|
"required": ["source_name", "source_copyright"],
|
219
|
"properties": {
|
220
|
"source_name": {
|
221
|
"$ref": "#/definitions/source_name"
|
222
|
},
|
223
|
"source_copyright": {
|
224
|
"description": "Which files indicate license terms of the source package and should be installed",
|
225
|
"$ref": "#/definitions/file_ref_list_sha256"
|
226
|
},
|
227
|
"generated_by": {
|
228
|
"$ref": "#/definitions/generated_by"
|
229
|
}
|
230
|
}
|
231
|
}
|
232
|
}
|
233
|
}
|