summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-02-04 10:29:46 +0100
committerWojtek Kosior <koszko@koszko.org>2022-02-04 10:29:46 +0100
commitea7b9b1e3d3e88a3dccfb95241845a6797463e56 (patch)
treed261d09dcf1b7f7ba055c75ec41796d2b861016a
downloadhydrilla-json-schemas-ea7b9b1e3d3e88a3dccfb95241845a6797463e56.tar.gz
hydrilla-json-schemas-ea7b9b1e3d3e88a3dccfb95241845a6797463e56.zip
initial commit
-rw-r--r--package_source-1.schema.json213
-rw-r--r--package_source-1.schema.json.license5
2 files changed, 218 insertions, 0 deletions
diff --git a/package_source-1.schema.json b/package_source-1.schema.json
new file mode 100644
index 0000000..8df3722
--- /dev/null
+++ b/package_source-1.schema.json
@@ -0,0 +1,213 @@
+{
+ "$schema": "https://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"
+ ],
+ "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"
+ }
+ }]
+ }
+ }
+ }
+ }
+}
diff --git a/package_source-1.schema.json.license b/package_source-1.schema.json.license
new file mode 100644
index 0000000..f41d511
--- /dev/null
+++ b/package_source-1.schema.json.license
@@ -0,0 +1,5 @@
+SPDX-License-Identifier: CC0-1.0
+
+Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
+
+Available under the terms of Creative Commons Zero v1.0 Universal.