Project

General

Profile

Download (5.42 KB) Statistics
| Branch: | Tag: | Revision:

hydrilla-json-schemas / package_source-1.schema.json @ ea7b9b1e

1 ea7b9b1e Wojtek Kosior
{
2
    "$schema": "https://json-schema.org/draft-07/schema",
3
    "$id": "https://hydrilla.koszko.org/package_source-1.schema.json",
4
    "title": "Package source",
5
    "description": "Definition of a Hydrilla source package",
6
    "type": "object",
7
    "required": [
8
	"source_schema_version",
9
	"source_name",
10
	"copyright",
11
	"upstream_url"
12
    ],
13
    "properties": {
14
	"source_schema_version": {
15
	    "description": "Which version of Hydrilla source package schema this definition conforms to",
16
	    "type": "array",
17
	    "minItems": 1,
18
	    "items": [{
19
		"const": 1
20
	    }],
21
	    "additionalItems": {
22
		"type": "integer",
23
		"minimum": 0
24
	    },
25
	    "minItems": 1
26
	},
27
	"source_name": {
28
	    "description": "Unique identifier of this source package",
29
	    "type": "string",
30
	    "pattern": "^[-0-9a-z.]+$"
31
	},
32
	"copyright":  {
33
	    "description": "Which files from the source package indicate its license terms and should be included in the distribution packages",
34
	    "type": "array",
35
	    "items": {
36
		"$ref": "#/definitions/file_ref"
37
	    }
38
	},
39
	"upstream_url": {
40
	    "description": "Where this software/work initially comes from",
41
	    "type": "string"
42
	},
43
	"comment": {
44
	    "$ref": "#/definitions/comment"
45
	},
46
	"definitions": {
47
	    "description": "Definitions of site resources and pattern->payload mappings",
48
	    "type": "array",
49
	    "items": {
50
		"allOf": [{
51
		    "description": "Item definition (fields common to both resources and mappings)",
52
		    "type": "object",
53
		    "required": [
54
			"type",
55
			"identifier",
56
			"long_name",
57
			"uuid",
58
			"version",
59
			"description"
60
		    ],
61
		    "properties": {
62
			"type": {
63
			    "description": "What kind of item is being defined (resource or mapping)",
64
			    "enum": ["resource", "mapping"]
65
			},
66
			"identifier": {
67
			    "$ref": "#/definitions/item_identifier"
68
			},
69
			"long_name": {
70
			    "description": "User-friendly alternative to an identifier",
71
			    "type": "string"
72
			},
73
			"uuid": {
74
			    "description": "UUIDv4 of this item (shared with other versions of this item, otherwise unique)",
75
			    "type": "string",
76
			    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
77
			},
78
			"version": {
79
			    "description": "Item's version number",
80
			    "type": "array",
81
			    "minItems": 1,
82
			    "items": {
83
				"type": "integer",
84
				"minimum": 0
85
			    },
86
			    "contains": {
87
				"type": "integer",
88
				"minimum": 1
89
			    },
90
			    "minItems": 1
91
			},
92
			"description": {
93
			    "description": "Item's description",
94
			    "type": "string"
95
			},
96
			"comment": {
97
			    "$ref": "#/definitions/comment"
98
			}
99
		    }
100
		}, {
101
		    "anyOf": [{
102
			"$ref": "#/definitions/resource_definition"
103
		    }, {
104
			"$ref": "#/definitions/mapping_definition"
105
		    }]
106
		}]
107
	    }
108
	},
109
	"additional_files": {
110
	    "description": "Files which should be included in the source archive produced by Hydrilla builder in addition to script and copyright files",
111
	    "type": "array",
112
	    "items": {
113
		"$ref": "#/definitions/file_ref"
114
	    },
115
	    "default": []
116
	},
117
	"reuse_generate_spdx_report": {
118
	    "description": "Should report.spdx be automatically generated for the package using REUSE tool",
119
	    "type": "boolean",
120
	    "default": false
121
	}
122
    },
123
    "definitions": {
124
	"comment": {
125
	    "description": "An optional comment",
126
	    "type": "string"
127
	},
128
        "file_ref": {
129
	    "type": "object",
130
	    "required": ["file"],
131
	    "properties": {
132
		"file": {
133
		    "description": "Filename relative to source package main directory; separator is '/'",
134
		    "type": "string",
135
		    "pattern": "^[^/]"
136
		}
137
	    }
138
        },
139
	"item_identifier": {
140
	    "description": "Identifier of an item (shared with other versions of the item, otherwise unique)",
141
	    "type": "string",
142
	    "pattern": "^[-0-9a-z]+$"
143
	},
144
	"resource_definition": {
145
	    "description": "Resource definition (fields specific to resource)",
146
	    "type": "object",
147
	    "required": [
148
		"type",
149
		"revision"
150
	    ],
151
	    "properties": {
152
		"type": {
153
		    "description": "Identify this item as a resource",
154
		    "const": "resource"
155
		},
156
		"revision": {
157
		    "description": "Which revision of a packaging of given version of an upstream resource is this",
158
		    "type": "integer",
159
		    "minimum": 1
160
		},
161
		"scripts": {
162
		    "description": "Which files from the source package are scripts to be included in the resource",
163
		    "type": "array",
164
		    "items":{
165
			"$ref": "#/definitions/file_ref"
166
		    },
167
		    "default": []
168
		},
169
		"dependencies": {
170
		    "description": "What other resources this one depends on",
171
		    "type": "array",
172
		    "items": {
173
			"$ref": "#/definitions/item_identifier"
174
		    },
175
		    "default": []
176
		}
177
	    }
178
	},
179
	"mapping_definition": {
180
	    "description": "Mapping definition (fields specific to mapping)",
181
	    "type": "object",
182
	    "required": ["type"],
183
	    "properties": {
184
		"type": {
185
		    "description": "Identify this item as a mapping",
186
		    "const": "mapping"
187
		},
188
		"payloads": {
189
		    "description": "Which payloads are to be applied to which URLs",
190
		    "additionalProperties": {
191
			"description": "Which payload applies to URLs matching given pattern",
192
			"type": "object",
193
					    "required": ["identifier"],
194
			"properties": {
195
			    "identifier": {
196
				"$ref": "#/definitions/item_identifier"
197
			    }
198
			}
199
		    },
200
		    "default": {},
201
		    "examples": [{
202
			"https://hydrillabugs.koszko.org/***": {
203
			    "identifier": "helloapple"
204
			},
205
			"https://*.koszko.org/***": {
206
			    "identifier": "hello-potato"
207
			}
208
		    }]
209
		}
210
	    }
211
	}
212
    }
213
}