summaryrefslogtreecommitdiff
path: root/package_source-1.schema.json
blob: 3a0ce0344499e8392b2eec4ab2901519ba5b340d (plain)
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://hydrilla.koszko.org/package_source-1.schema.json",
    "title": "Package source",
    "description": "Definition of a Hydrilla source package",
    "type": "object",
    "required": [
	"source_schema_version",
	"source_name",
	"copyright",
	"upstream_url",
	"definitions"
    ],
    "properties": {
	"source_schema_version": {
	    "description": "Which version of Hydrilla source package schema this definition conforms to",
	    "type": "array",
	    "minItems": 1,
	    "items": [{
		"const": 1
	    }],
	    "additionalItems": {
		"type": "integer",
		"minimum": 0
	    },
	    "minItems": 1
	},
	"source_name": {
	    "description": "Unique identifier of this source package",
	    "type": "string",
	    "pattern": "^[-0-9a-z.]+$"
	},
	"copyright":  {
	    "description": "Which files from the source package indicate its license terms and should be included in the distribution packages",
	    "type": "array",
	    "items": {
		"$ref": "#/definitions/file_ref"
	    }
	},
	"upstream_url": {
	    "description": "Where this software/work initially comes from",
	    "type": "string"
	},
	"comment": {
	    "$ref": "#/definitions/comment"
	},
	"definitions": {
	    "description": "Definitions of site resources and pattern->payload mappings",
	    "type": "array",
	    "items": {
		"allOf": [{
		    "description": "Item definition (fields common to both resources and mappings)",
		    "type": "object",
		    "required": [
			"type",
			"identifier",
			"long_name",
			"uuid",
			"version",
			"description"
		    ],
		    "properties": {
			"type": {
			    "description": "What kind of item is being defined (resource or mapping)",
			    "enum": ["resource", "mapping"]
			},
			"identifier": {
			    "$ref": "#/definitions/item_identifier"
			},
			"long_name": {
			    "description": "User-friendly alternative to an identifier",
			    "type": "string"
			},
			"uuid": {
			    "description": "UUIDv4 of this item (shared with other versions of this item, otherwise unique)",
			    "type": "string",
			    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
			},
			"version": {
			    "description": "Item's version number",
			    "type": "array",
			    "minItems": 1,
			    "items": {
				"type": "integer",
				"minimum": 0
			    },
			    "contains": {
				"type": "integer",
				"minimum": 1
			    },
			    "minItems": 1
			},
			"description": {
			    "description": "Item's description",
			    "type": "string"
			},
			"comment": {
			    "$ref": "#/definitions/comment"
			}
		    }
		}, {
		    "anyOf": [{
			"$ref": "#/definitions/resource_definition"
		    }, {
			"$ref": "#/definitions/mapping_definition"
		    }]
		}]
	    }
	},
	"additional_files": {
	    "description": "Files which should be included in the source archive produced by Hydrilla builder in addition to script and copyright files",
	    "type": "array",
	    "items": {
		"$ref": "#/definitions/file_ref"
	    },
	    "default": []
	},
	"reuse_generate_spdx_report": {
	    "description": "Should report.spdx be automatically generated for the package using REUSE tool",
	    "type": "boolean",
	    "default": false
	}
    },
    "definitions": {
	"comment": {
	    "description": "An optional comment",
	    "type": "string"
	},
        "file_ref": {
	    "type": "object",
	    "required": ["file"],
	    "properties": {
		"file": {
		    "description": "Filename relative to source package main directory; separator is '/'",
		    "type": "string",
		    "pattern": "^[^/]"
		}
	    }
        },
	"item_identifier": {
	    "description": "Identifier of an item (shared with other versions of the item, otherwise unique)",
	    "type": "string",
	    "pattern": "^[-0-9a-z]+$"
	},
	"resource_definition": {
	    "description": "Resource definition (fields specific to resource)",
	    "type": "object",
	    "required": [
		"type",
		"revision"
	    ],
	    "properties": {
		"type": {
		    "description": "Identify this item as a resource",
		    "const": "resource"
		},
		"revision": {
		    "description": "Which revision of a packaging of given version of an upstream resource is this",
		    "type": "integer",
		    "minimum": 1
		},
		"scripts": {
		    "description": "Which files from the source package are scripts to be included in the resource",
		    "type": "array",
		    "items":{
			"$ref": "#/definitions/file_ref"
		    },
		    "default": []
		},
		"dependencies": {
		    "description": "What other resources this one depends on",
		    "type": "array",
		    "items": {
			"$ref": "#/definitions/item_identifier"
		    },
		    "default": []
		}
	    }
	},
	"mapping_definition": {
	    "description": "Mapping definition (fields specific to mapping)",
	    "type": "object",
	    "required": ["type"],
	    "properties": {
		"type": {
		    "description": "Identify this item as a mapping",
		    "const": "mapping"
		},
		"payloads": {
		    "description": "Which payloads are to be applied to which URLs",
		    "additionalProperties": {
			"description": "Which payload applies to URLs matching given pattern",
			"type": "object",
					    "required": ["identifier"],
			"properties": {
			    "identifier": {
				"$ref": "#/definitions/item_identifier"
			    }
			}
		    },
		    "default": {},
		    "examples": [{
			"https://hydrillabugs.koszko.org/***": {
			    "identifier": "helloapple"
			},
			"https://*.koszko.org/***": {
			    "identifier": "hello-potato"
			}
		    }]
		}
	    }
	}
    }
}