Project

General

Profile

« Previous | Next » 

Revision 7206db45

Added by koszko over 1 year ago

move all schema files to 2.x version series

This commit also introduces:

  • combined source definitions of resource and mapping,
  • dependencies on mappings,
  • permissions,
  • Haketilo version constraints.

View differences:

api_mapping_description-1.0.1.schema.json
1
{
2
    "$schema": "http://json-schema.org/draft-07/schema#",
3
    "$id": "https://hydrilla.koszko.org/schemas/api_mapping_description-1.0.1.schema.json",
4
    "title": "Mapping description",
5
    "description": "Definition of a Hydrilla mapping, as served through HTTP API",
6
    "allOf": [{
7
	"$ref": "./common_definitions-1.0.1.schema.json#/definitions/mapping_definition_base"
8
    }, {
9
	"$ref": "./common_definitions-1.0.1.schema.json#/definitions/item_definition"
10
    }, {
11
	"type": "object",
12
	"required": ["$schema"],
13
	"properties": {
14
	    "$schema": {
15
		"description": "Mark this instance as conforming to mapping description schema 1.x",
16
		"type": "string",
17
		"pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_mapping_description-1\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
18
	    }
19
	}
20
    }]
21
}
api_mapping_description-1.0.1.schema.json.license
1
SPDX-License-Identifier: CC0-1.0
2

  
3
Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
4

  
5
Available under the terms of Creative Commons Zero v1.0 Universal.
api_mapping_description-2.schema.json
1
{
2
    "$schema": "http://json-schema.org/draft-07/schema#",
3
    "$id": "https://hydrilla.koszko.org/schemas/api_mapping_description-2.schema.json",
4
    "title": "Mapping description",
5
    "description": "Definition of a Hydrilla mapping, as served through HTTP API",
6
    "allOf": [{
7
	"$ref": "./common_definitions-2.schema.json#/definitions/mapping_definition_base"
8
    }, {
9
	"$ref": "./common_definitions-2.schema.json#/definitions/item_definition"
10
    }, {
11
	"type": "object",
12
	"required": ["$schema", "type"],
13
	"properties": {
14
	    "$schema": {
15
		"description": "Mark this instance as conforming to mapping description schema 2.x",
16
		"type": "string",
17
		"pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_mapping_description-2\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
18
	    },
19
	    "type": {
20
		"description": "Identify this item as a mapping",
21
		"const": "mapping"
22
	    }
23
	}
24
    }]
25
}
api_mapping_description-2.schema.json.license
1
SPDX-License-Identifier: CC0-1.0
2

  
3
Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
4

  
5
Available under the terms of Creative Commons Zero v1.0 Universal.
api_query_result-1.0.1.schema.json
1
{
2
    "$schema": "http://json-schema.org/draft-07/schema#",
3
    "$id": "https://hydrilla.koszko.org/schemas/api_query_result-1.0.1.schema.json",
4
    "title": "Query result",
5
    "description": "Object with a list of references to mappings that contain payloads for requested URL",
6
    "type": "object",
7
    "required": ["$schema", "mappings"],
8
    "properties": {
9
	"$schema": {
10
	    "description": "Mark this instance as conforming to query result schema 1.x",
11
	    "type": "string",
12
	    "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_query_result-1\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
13
	},
14
	"mappings": {
15
	    "description": "References to mappings using at least one pattern that matches the requested URL",
16
	    "type": "array",
17
	    "items": {
18
		"$ref": "./common_definitions-1.0.1.schema.json#/definitions/item_ref"
19
	    }
20
	},
21
	"generated_by": {
22
	    "$ref": "./common_definitions-1.0.1.schema.json#/definitions/generated_by"
23
	}
24
    }
25
}
api_query_result-1.0.1.schema.json.license
1
SPDX-License-Identifier: CC0-1.0
2

  
3
Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
4

  
5
Available under the terms of Creative Commons Zero v1.0 Universal.
api_query_result-2.schema.json
1
{
2
    "$schema": "http://json-schema.org/draft-07/schema#",
3
    "$id": "https://hydrilla.koszko.org/schemas/api_query_result-2.schema.json",
4
    "title": "Query result",
5
    "description": "Object with a list of references to mappings that contain payloads for requested URL",
6
    "type": "object",
7
    "required": ["$schema", "mappings"],
8
    "properties": {
9
	"$schema": {
10
	    "description": "Mark this instance as conforming to query result schema 2.x",
11
	    "type": "string",
12
	    "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_query_result-2\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
13
	},
14
	"mappings": {
15
	    "description": "References to mappings using at least one pattern that matches the requested URL",
16
	    "type": "array",
17
	    "items": {
18
		"$ref": "./common_definitions-2.schema.json#/definitions/item_ref"
19
	    }
20
	},
21
	"generated_by": {
22
	    "$ref": "./common_definitions-2.schema.json#/definitions/generated_by"
23
	}
24
    }
25
}
api_query_result-2.schema.json.license
1
SPDX-License-Identifier: CC0-1.0
2

  
3
Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
4

  
5
Available under the terms of Creative Commons Zero v1.0 Universal.
api_resource_description-1.0.1.schema.json
1
{
2
    "$schema": "http://json-schema.org/draft-07/schema#",
3
    "$id": "https://hydrilla.koszko.org/schemas/api_resource_description-1.0.1.schema.json",
4
    "title": "Resource description",
5
    "description": "Definition of a Hydrilla resource, as served through HTTP API",
6
    "allOf": [{
7
	"$ref": "./common_definitions-1.0.1.schema.json#/definitions/resource_definition_base"
8
    }, {
9
	"$ref": "./common_definitions-1.0.1.schema.json#/definitions/item_definition"
10
    }, {
11
	"type": "object",
12
	"required": ["$schema"],
13
	"properties": {
14
	    "$schema": {
15
		"description": "Mark this instance as conforming to resource description schema 1.x",
16
		"type": "string",
17
		"pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_resource_description-1\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
18
	    },
19
	    "scripts": {
20
		"description": "Which files are resource's scripts and need to be installed",
21
		"$ref": "./common_definitions-1.0.1.schema.json#/definitions/file_ref_list_sha256",
22
		"default": []
23
	    }
24
	}
25
    }]
26
}
api_resource_description-1.0.1.schema.json.license
1
SPDX-License-Identifier: CC0-1.0
2

  
3
Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
4

  
5
Available under the terms of Creative Commons Zero v1.0 Universal.
api_resource_description-2.schema.json
1
{
2
    "$schema": "http://json-schema.org/draft-07/schema#",
3
    "$id": "https://hydrilla.koszko.org/schemas/api_resource_description-2.schema.json",
4
    "title": "Resource description",
5
    "description": "Definition of a Hydrilla resource, as served through HTTP API",
6
    "allOf": [{
7
	"$ref": "./common_definitions-2.schema.json#/definitions/resource_definition_base"
8
    }, {
9
	"$ref": "./common_definitions-2.schema.json#/definitions/item_definition"
10
    }, {
11
	"type": "object",
12
	"required": ["$schema", "type"],
13
	"properties": {
14
	    "$schema": {
15
		"description": "Mark this instance as conforming to resource description schema 2.x",
16
		"type": "string",
17
		"pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_resource_description-2\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
18
	    },
19
	    "type": {
20
		"description": "Identify this item as a resource",
21
		"const": "resource"
22
	    },
23
	    "scripts": {
24
		"description": "Which files are resource's scripts and need to be installed",
25
		"$ref": "./common_definitions-2.schema.json#/definitions/file_ref_list_sha256",
26
		"default": []
27
	    },
28
	    "dependencies": {
29
		"description": "Which other resources this resource depends on",
30
		"$ref": "./common_definitions-2.schema.json#/definitions/item_dep_specifier_array",
31
		"default": []
32
	    }
33
	}
34
    }]
35
}
api_resource_description-2.schema.json.license
1
SPDX-License-Identifier: CC0-1.0
2

  
3
Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
4

  
5
Available under the terms of Creative Commons Zero v1.0 Universal.
api_source_description-1.0.1.schema.json
1
{
2
    "$schema": "http://json-schema.org/draft-07/schema#",
3
    "$id": "https://hydrilla.koszko.org/schemas/api_source_description-1.0.1.schema.json",
4
    "title": "Source description",
5
    "description": "Built description of a Hydrilla source package",
6
    "type": "object",
7
    "required": [
8
	"$schema",
9
	"source_name",
10
	"source_copyright",
11
	"source_archives",
12
	"upstream_url",
13
	"definitions"
14
    ],
15
    "properties": {
16
	"$schema": {
17
	    "description": "Mark this instance as conforming to source description schema 1.x",
18
	    "type": "string",
19
	    "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_source_description-1\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
20
	},
21
	"source_name": {
22
	    "$ref": "./common_definitions-1.0.1.schema.json#/definitions/source_name"
23
	},
24
	"source_copyright":  {
25
	    "description": "Which files indicate license terms of the source package",
26
	    "$ref": "./common_definitions-1.0.1.schema.json#/definitions/file_ref_list_sha256"
27
	},
28
	"source_archives": {
29
	    "description": "What archive extensions are available for this package's sources",
30
	    "type": "object",
31
	    "required": ["zip"],
32
	    "additionalProperties": {
33
		"description": "What is the SHA256 sum of given source archive",
34
		"type": "object",
35
		"required": ["sha256"],
36
		"properties": {
37
		    "sha256": {
38
			"$ref": "./common_definitions-1.0.1.schema.json#/definitions/sha256"
39
		    }
40
		}
41
	    },
42
	    "examples": [{
43
		"zip": {
44
		    "sha256": "688461da362ffe2fc8e85db73e709a5356d41c8aeb7d1eee7170c64ee21dd2a2"
45
		}
46
	    }]
47
	},
48
	"upstream_url": {
49
	    "description": "Where this software/work initially comes from",
50
	    "type": "string"
51
	},
52
	"comment": {
53
	    "$ref": "./common_definitions-1.0.1.schema.json#/definitions/comment"
54
	},
55
	"definitions": {
56
	    "description": "References to site resources and pattern->payload mappings",
57
	    "type": "array",
58
	    "items": {
59
		"$ref": "./common_definitions-1.0.1.schema.json#/definitions/typed_item_ref"
60
	    }
61
	},
62
	"generated_by": {
63
	    "$ref": "./common_definitions-1.0.1.schema.json#/definitions/generated_by"
64
	}
65
    }
66
}
api_source_description-1.0.1.schema.json.license
1
SPDX-License-Identifier: CC0-1.0
2

  
3
Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
4

  
5
Available under the terms of Creative Commons Zero v1.0 Universal.
api_source_description-2.schema.json
1
{
2
    "$schema": "http://json-schema.org/draft-07/schema#",
3
    "$id": "https://hydrilla.koszko.org/schemas/api_source_description-2.schema.json",
4
    "title": "Source description",
5
    "description": "Built description of a Hydrilla source package",
6
    "type": "object",
7
    "required": [
8
	"$schema",
9
	"source_name",
10
	"source_copyright",
11
	"source_archives",
12
	"upstream_url",
13
	"definitions"
14
    ],
15
    "properties": {
16
	"$schema": {
17
	    "description": "Mark this instance as conforming to source description schema 2.x",
18
	    "type": "string",
19
	    "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_source_description-2\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
20
	},
21
	"source_name": {
22
	    "$ref": "./common_definitions-2.schema.json#/definitions/source_name"
23
	},
24
	"source_copyright":  {
25
	    "description": "Which files indicate license terms of the source package",
26
	    "$ref": "./common_definitions-2.schema.json#/definitions/file_ref_list_sha256"
27
	},
28
	"source_archives": {
29
	    "description": "What archive extensions are available for this package's sources",
30
	    "type": "object",
31
	    "required": ["zip"],
32
	    "additionalProperties": {
33
		"description": "What is the SHA256 sum of given source archive",
34
		"type": "object",
35
		"required": ["sha256"],
36
		"properties": {
37
		    "sha256": {
38
			"$ref": "./common_definitions-2.schema.json#/definitions/sha256"
39
		    }
40
		}
41
	    },
42
	    "examples": [{
43
		"zip": {
44
		    "sha256": "688461da362ffe2fc8e85db73e709a5356d41c8aeb7d1eee7170c64ee21dd2a2"
45
		}
46
	    }]
47
	},
48
	"upstream_url": {
49
	    "description": "Where this software/work initially comes from",
50
	    "type": "string"
51
	},
52
	"comment": {
53
	    "$ref": "./common_definitions-2.schema.json#/definitions/comment"
54
	},
55
	"definitions": {
56
	    "description": "References to site resources and pattern->payload mappings",
57
	    "type": "array",
58
	    "items": {
59
		"$ref": "./common_definitions-2.schema.json#/definitions/typed_item_ref"
60
	    }
61
	},
62
	"generated_by": {
63
	    "$ref": "./common_definitions-2.schema.json#/definitions/generated_by"
64
	}
65
    }
66
}
api_source_description-2.schema.json.license
1
SPDX-License-Identifier: CC0-1.0
2

  
3
Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
4

  
5
Available under the terms of Creative Commons Zero v1.0 Universal.
common_definitions-1.0.1.schema.json
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
}
common_definitions-1.0.1.schema.json.license
1
SPDX-License-Identifier: CC0-1.0
2

  
3
Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
4

  
5
Available under the terms of Creative Commons Zero v1.0 Universal.
common_definitions-2.schema.json
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
}
common_definitions-2.schema.json.license
1
SPDX-License-Identifier: CC0-1.0
2

  
3
Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
4

  
5
Available under the terms of Creative Commons Zero v1.0 Universal.
package_source-2.schema.json
3 3
    "$id": "https://hydrilla.koszko.org/schemas/package_source-2.schema.json",
4 4
    "title": "Package source",
5 5
    "description": "Definition of a Hydrilla source package",
6
    "allOf": [{
7
	"description": "Definition of a Hydrilla source package - validation rules common for all minor schema versions",
8
	"type": "object",
9
	"required": [
10
	    "$schema",
11
	    "source_name",
12
	    "copyright",
13
	    "upstream_url",
14
	    "definitions"
15
	],
16
	"properties": {
17
	    "$schema": {
18
		"description": "Mark this instance as conforming to package source schema 1.x or 2.x",
19
		"type": "string",
20
		"pattern": "^https://hydrilla\\.koszko\\.org/schemas/package_source-[12]\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
21
	    },
22
	    "source_name": {
23
		"$ref": "./common_definitions-1.0.1.schema.json#/definitions/source_name"
24
	    },
25
	    "copyright":  {
26
		"description": "Which files from the source package indicate its license terms and should be included in the distribution packages",
27
		"$ref": "./common_definitions-1.0.1.schema.json#/definitions/file_ref_list"
28
	    },
29
	    "upstream_url": {
30
		"description": "Where this software/work initially comes from",
31
		"type": "string"
32
	    },
33
	    "comment": {
34
		"$ref": "./common_definitions-1.0.1.schema.json#/definitions/comment"
35
	    },
36
	    "definitions": {
37
		"description": "Definitions of site resources and pattern->payload mappings",
38
		"type": "array",
39
		"items": {
40
		    "anyOf": [{
41
			"$ref": "./common_definitions-1.0.1.schema.json#/definitions/resource_definition_base"
42
		    }, {
43
			"$ref": "./common_definitions-1.0.1.schema.json#/definitions/mapping_definition_base"
44
		    }]
45
		}
46
	    },
47
	    "additional_files": {
48
		"description": "Files which should be included in the source archive produced by Hydrilla builder in addition to script and copyright files",
49
		"$ref": "./common_definitions-1.0.1.schema.json#/definitions/file_ref_list",
50
		"default": []
51
	    },
52
	    "reuse_generate_spdx_report": {
53
		"description": "Should report.spdx be automatically generated for the package using REUSE tool",
54
		"type": "boolean",
55
		"default": false
56
	    }
57
	}
58
    }, {
59
	"description": "Definition of a Hydrilla source package - validation rules common for versions 2 and higher",
60
	"if": {
61
	    "type": "object",
62
	    "properties": {
63
		"$schema": {
64
		    "description": "Select instances that specify schema version 1.0.x",
65
		    "type": "string",
66
		    "pattern": "^https://hydrilla\\.koszko\\.org/schemas/package_source-2\\..*schema\\.json$"
67
		}
68
	    }
6
    "type": "object",
7
    "required": [
8
	"$schema",
9
	"source_name",
10
	"copyright",
11
	"upstream_url",
12
	"definitions"
13
    ],
14
    "properties": {
15
	"$schema": {
16
	    "description": "Mark this instance as conforming to package source schema 2.x",
17
	    "type": "string",
18
	    "pattern": "^https://hydrilla\\.koszko\\.org/schemas/package_source-2\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
69 19
	},
70
	"else": {
71
	    "description": "Validate the piggybacking correctness",
72
	    "type": "object",
73
	    "properties": {
74
		"piggyback_on": {
75
		    "anyOf": [{
76
			"$ref": "#/definitions/piggyback_apt"
77
		    }]
78
		}
20
	"source_name": {
21
	    "$ref": "./common_definitions-2.schema.json#/definitions/source_name"
22
	},
23
	"copyright":  {
24
	    "description": "Which files from the source package indicate its license terms and should be included in the distribution packages",
25
	    "$ref": "./common_definitions-2.schema.json#/definitions/file_ref_list"
26
	},
27
	"upstream_url": {
28
	    "description": "Where this software/work initially comes from",
29
	    "type": "string"
30
	},
31
	"piggyback_on": {
32
	    "description": "Specify packages from other software system that should be used for constructing this package",
33
	    "anyOf": [{
34
		"$ref": "#/definitions/piggyback_apt"
35
	    }]
36
	},
37
	"comment": {
38
	    "$ref": "./common_definitions-2.schema.json#/definitions/comment"
39
	},
40
	"definitions": {
41
	    "description": "Definitions of site resources and pattern->payload mappings (possibly combined together)",
42
	    "type": "array",
43
	    "items": {
44
		"$ref": "#/definitions/item_definition"
79 45
	    }
46
	},
47
	"additional_files": {
48
	    "description": "Files which should be included in the source archive produced by Hydrilla builder in addition to script and copyright files",
49
	    "$ref": "./common_definitions-2.schema.json#/definitions/file_ref_list",
50
	    "default": []
51
	},
52
	"reuse_generate_spdx_report": {
53
	    "description": "Should report.spdx be automatically generated for the package using REUSE tool",
54
	    "type": "boolean",
55
	    "default": false
80 56
	}
81
    }],
57
    },
82 58
    "definitions": {
83 59
	"piggyback_apt": {
84 60
	    "description": "Specify packages from APT software system that should be used for constructing this package",
......
136 112
		    "default": true
137 113
		}
138 114
	    }
115
	},
116
	"item_definition": {
117
	    "description": "Definition of either a site resource, a pattern->payload mapping or both combined together",
118
	    "if": {
119
		"type": "object",
120
		"required": ["type"],
121
		"properties": {
122
		    "type": {
123
			"const": "resource"
124
		    }
125
		}
126
	    },
127
	    "then": {
128
		"$ref": "./common_definitions-2.schema.json#/definitions/resource_definition_base"
129
	    },
130
	    "else": {
131
		"if": {
132
		    "type": "object",
133
		    "required": ["type"],
134
		    "properties": {
135
			"type": {
136
			    "const": "mapping"
137
			}
138
		    }
139
		},
140
		"then": {
141
		    "$ref": "./common_definitions-2.schema.json#/definitions/mapping_definition_base"
142
		},
143
		"else": {
144
		    "allOf": [{
145
			"type": "object",
146
			"required": ["type"],
147
			"properties": {
148
			    "type": {
149
				"const": "mapping_and_resource"
150
			    }
151
			}
152
		    }, {
153
			"$ref": "#/definitions/combined_mapping_resource_definition"
154
		    }]
155
		}
156
	    }
157
	},
158
	"combined_mapping_resource_definition": {
159
	    "allOf": [{
160
		"$ref": "./common_definitions-2.schema.json#/definitions/mapping_definition_base"
161
	    }, {
162
		"$ref": "./common_definitions-2.schema.json#/definitions/resource_definition_base"
163
	    }]
139 164
	}
140 165
    }
141 166
}

Also available in: Unified diff