summaryrefslogtreecommitdiff
path: root/common_definitions-2.schema.json
diff options
context:
space:
mode:
Diffstat (limited to 'common_definitions-2.schema.json')
-rw-r--r--common_definitions-2.schema.json254
1 files changed, 254 insertions, 0 deletions
diff --git a/common_definitions-2.schema.json b/common_definitions-2.schema.json
new file mode 100644
index 0000000..1700f34
--- /dev/null
+++ b/common_definitions-2.schema.json
@@ -0,0 +1,254 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$id": "https://hydrilla.koszko.org/schemas/common_definitions-2.schema.json",
+ "title": "Common definitions",
+ "description": "Definitions used by other Hydrilla schemas",
+ "definitions": {
+ "version": {
+ "description": "Version expressed as an array of integers",
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "contains": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "minItems": 1
+ },
+ "source_name": {
+ "description": "Unique identifier of this source package",
+ "type": "string",
+ "pattern": "^[-0-9a-z.]+$"
+ },
+ "comment": {
+ "description": "An optional comment",
+ "type": "string"
+ },
+ "file_ref_list": {
+ "description": "List of simple file references",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "required": ["file"],
+ "properties": {
+ "file": {
+ "description": "Filename relative to source package main directory; separator is '/'",
+ "type": "string",
+ "pattern": "^[^/]"
+ }
+ }
+ }
+ },
+ "sha256": {
+ "description": "An SHA256 sum, in hexadecimal",
+ "type": "string",
+ "pattern": "^[0-9a-f]{64}$"
+ },
+ "file_ref_list_sha256": {
+ "description": "List of file references with files' SHA256 sums included",
+ "allOf": [{
+ "$ref": "#/definitions/file_ref_list"
+ }, {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "required": ["sha256"],
+ "properties": {
+ "sha256": {
+ "$ref": "#/definitions/sha256"
+ }
+ }
+ }
+ }]
+ },
+ "item_identifier": {
+ "description": "Identifier of an item (shared with other versions of the item, otherwise unique)",
+ "type": "string",
+ "pattern": "^[-0-9a-z]+$"
+ },
+ "item_dep_specifier": {
+ "description": "Simple reference to an item as a dependency",
+ "type": "object",
+ "required": ["identifier"],
+ "properties": {
+ "identifier": {
+ "$ref": "#/definitions/item_identifier"
+ }
+ }
+ },
+ "item_dep_specifier_array": {
+ "description": "Array of references to items as dependencies",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/item_dep_specifier"
+ }
+ },
+ "item_ref": {
+ "description": "An object containing a subset of fields from full item definition",
+ "type": "object",
+ "required": ["identifier", "long_name", "version"],
+ "properties": {
+ "identifier": {
+ "$ref": "#/definitions/item_identifier"
+ },
+ "long_name": {
+ "description": "User-friendly alternative to the identifier",
+ "type": "string"
+ },
+ "version": {
+ "$ref": "#/definitions/version"
+ }
+ }
+ },
+ "typed_item_ref": {
+ "description": "An object containing a subset of fields from full item definition, including type",
+ "allOf": [{
+ "$ref": "#/definitions/item_ref"
+ }, {
+ "type": "object",
+ "required": ["type"],
+ "properties": {
+ "type": {
+ "description": "What kind of item is it (resource or mapping)",
+ "enum": ["resource", "mapping"]
+ }
+ }
+ }]
+ },
+ "item_definition_base": {
+ "description": "Definition of a resource/mapping (fields common to source definitions and built definitions)",
+ "allOf": [{
+ "$ref": "#/definitions/item_ref"
+ }, {
+ "type": "object",
+ "required": ["description"],
+ "properties": {
+ "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}$"
+ },
+ "description": {
+ "description": "Item's description",
+ "type": "string"
+ },
+ "min_haketilo_version": {
+ "description": "Specify that this item should not be used with Haketilo versions older than specified here",
+ "$ref": "#/definitions/version",
+ "default": [1]
+ },
+ "max_haketilo_version": {
+ "description": "Specify that this item should not be used with Haketilo versions newer than specified here",
+ "$ref": "#/definitions/version",
+ "default": [65536]
+ },
+ "permissions": {
+ "description": "What privileges should be granted on pages where this resource/mapping is used",
+ "type": "object",
+ "properties": {
+ "cors_bypass": {
+ "description": "Specify if a page should be allowed to perform cross-origin requests",
+ "type": "boolean",
+ "default": false
+ },
+ "eval": {
+ "description": "Specify if scripts added to the page should be allowed to use eval() (and related mechanisms)",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "required_mappings": {
+ "description": "Which mappings this item requires to be enabled",
+ "$ref": "#/definitions/item_dep_specifier_array",
+ "default": []
+ },
+ "comment": {
+ "$ref": "#/definitions/comment"
+ }
+ }
+ }]
+ },
+ "resource_definition_base": {
+ "description": "Definition of a resource (fields common to source definitions and built definitions)",
+ "allOf": [{
+ "$ref": "#/definitions/item_definition_base"
+ }, {
+ "type": "object",
+ "required": ["type", "revision"],
+ "properties": {
+ "revision": {
+ "description": "Which revision of a packaging of given version of an upstream resource is this",
+ "type": "integer",
+ "minimum": 1
+ },
+ "scripts": {
+ "description": "What scripts are included in the resource",
+ "$ref": "#/definitions/file_ref_list",
+ "default": []
+ }
+ }
+ }]
+ },
+ "mapping_definition_base": {
+ "description": "Definition of a mapping (fields common to source definitions and built definitions)",
+ "allOf": [{
+ "$ref": "#/definitions/item_definition_base"
+ }, {
+ "type": "object",
+ "properties": {
+ "payloads": {
+ "description": "Which payloads are to be applied to which URLs",
+ "additionalProperties": {
+ "$ref": "#/definitions/item_dep_specifier"
+ },
+ "default": {},
+ "examples": [{
+ "https://hydrillabugs.koszko.org/***": {
+ "identifier": "helloapple"
+ },
+ "https://*.koszko.org/***": {
+ "identifier": "hello-potato"
+ }
+ }]
+ }
+ }
+ }]
+ },
+ "generated_by": {
+ "description": "Describe what software generated this instance",
+ "type": "object",
+ "required": ["name"],
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Instance generator software name, without version"
+ },
+ "version": {
+ "type": "string",
+ "description": "Instance generator software version, in arbitrary format"
+ }
+ }
+ },
+ "item_definition": {
+ "description": "Definition of a resource/mapping (fields specific to built definitions)",
+ "type": "object",
+ "required": ["source_name", "source_copyright"],
+ "properties": {
+ "source_name": {
+ "$ref": "#/definitions/source_name"
+ },
+ "source_copyright": {
+ "description": "Which files indicate license terms of the source package and should be installed",
+ "$ref": "#/definitions/file_ref_list_sha256"
+ },
+ "generated_by": {
+ "$ref": "#/definitions/generated_by"
+ }
+ }
+ }
+ }
+}