Project

General

Profile

« Previous | Next » 

Revision c72c8438

Added by koszko over 1 year ago

refactor some definitions into a separate file and add schemas for API endpoints

View differences:

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

Also available in: Unified diff