summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-05-27 15:46:34 +0200
committerWojtek Kosior <koszko@koszko.org>2022-05-31 19:40:40 +0200
commit7206db45f277c10c34d1b7ed9bd35343ac742d30 (patch)
treee85179e32a2c63bc98b4771fe1dae4ecdbec02cf
parent4b4da5a02bc311603469eea7b3dfd4f1bbb911fd (diff)
downloadhydrilla-json-schemas-koszko.tar.gz
hydrilla-json-schemas-koszko.zip
move all schema files to 2.x version seriesv2.0koszko
This commit also introduces: * combined source definitions of resource and mapping, * dependencies on mappings, * permissions, * Haketilo version constraints.
-rw-r--r--api_mapping_description-2.schema.json (renamed from api_mapping_description-1.0.1.schema.json)16
-rw-r--r--api_mapping_description-2.schema.json.license (renamed from api_mapping_description-1.0.1.schema.json.license)0
-rw-r--r--api_query_result-2.schema.json (renamed from api_query_result-1.0.1.schema.json)10
-rw-r--r--api_query_result-2.schema.json.license (renamed from api_query_result-1.0.1.schema.json.license)0
-rw-r--r--api_resource_description-1.0.1.schema.json26
-rw-r--r--api_resource_description-2.schema.json35
-rw-r--r--api_resource_description-2.schema.json.license (renamed from api_resource_description-1.0.1.schema.json.license)0
-rw-r--r--api_source_description-2.schema.json (renamed from api_source_description-1.0.1.schema.json)18
-rw-r--r--api_source_description-2.schema.json.license (renamed from api_source_description-1.0.1.schema.json.license)0
-rw-r--r--common_definitions-2.schema.json (renamed from common_definitions-1.0.1.schema.json)59
-rw-r--r--common_definitions-2.schema.json.license (renamed from common_definitions-1.0.1.schema.json.license)0
-rw-r--r--package_source-2.schema.json171
12 files changed, 197 insertions, 138 deletions
diff --git a/api_mapping_description-1.0.1.schema.json b/api_mapping_description-2.schema.json
index 880a5c4..e444180 100644
--- a/api_mapping_description-1.0.1.schema.json
+++ b/api_mapping_description-2.schema.json
@@ -1,20 +1,24 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
- "$id": "https://hydrilla.koszko.org/schemas/api_mapping_description-1.0.1.schema.json",
+ "$id": "https://hydrilla.koszko.org/schemas/api_mapping_description-2.schema.json",
"title": "Mapping description",
"description": "Definition of a Hydrilla mapping, as served through HTTP API",
"allOf": [{
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/mapping_definition_base"
+ "$ref": "./common_definitions-2.schema.json#/definitions/mapping_definition_base"
}, {
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/item_definition"
+ "$ref": "./common_definitions-2.schema.json#/definitions/item_definition"
}, {
"type": "object",
- "required": ["$schema"],
+ "required": ["$schema", "type"],
"properties": {
"$schema": {
- "description": "Mark this instance as conforming to mapping description schema 1.x",
+ "description": "Mark this instance as conforming to mapping description schema 2.x",
"type": "string",
- "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_mapping_description-1\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
+ "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_mapping_description-2\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
+ },
+ "type": {
+ "description": "Identify this item as a mapping",
+ "const": "mapping"
}
}
}]
diff --git a/api_mapping_description-1.0.1.schema.json.license b/api_mapping_description-2.schema.json.license
index f41d511..f41d511 100644
--- a/api_mapping_description-1.0.1.schema.json.license
+++ b/api_mapping_description-2.schema.json.license
diff --git a/api_query_result-1.0.1.schema.json b/api_query_result-2.schema.json
index 89c5428..727531c 100644
--- a/api_query_result-1.0.1.schema.json
+++ b/api_query_result-2.schema.json
@@ -1,25 +1,25 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
- "$id": "https://hydrilla.koszko.org/schemas/api_query_result-1.0.1.schema.json",
+ "$id": "https://hydrilla.koszko.org/schemas/api_query_result-2.schema.json",
"title": "Query result",
"description": "Object with a list of references to mappings that contain payloads for requested URL",
"type": "object",
"required": ["$schema", "mappings"],
"properties": {
"$schema": {
- "description": "Mark this instance as conforming to query result schema 1.x",
+ "description": "Mark this instance as conforming to query result schema 2.x",
"type": "string",
- "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_query_result-1\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
+ "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_query_result-2\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
},
"mappings": {
"description": "References to mappings using at least one pattern that matches the requested URL",
"type": "array",
"items": {
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/item_ref"
+ "$ref": "./common_definitions-2.schema.json#/definitions/item_ref"
}
},
"generated_by": {
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/generated_by"
+ "$ref": "./common_definitions-2.schema.json#/definitions/generated_by"
}
}
}
diff --git a/api_query_result-1.0.1.schema.json.license b/api_query_result-2.schema.json.license
index f41d511..f41d511 100644
--- a/api_query_result-1.0.1.schema.json.license
+++ b/api_query_result-2.schema.json.license
diff --git a/api_resource_description-1.0.1.schema.json b/api_resource_description-1.0.1.schema.json
deleted file mode 100644
index 7459394..0000000
--- a/api_resource_description-1.0.1.schema.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-07/schema#",
- "$id": "https://hydrilla.koszko.org/schemas/api_resource_description-1.0.1.schema.json",
- "title": "Resource description",
- "description": "Definition of a Hydrilla resource, as served through HTTP API",
- "allOf": [{
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/resource_definition_base"
- }, {
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/item_definition"
- }, {
- "type": "object",
- "required": ["$schema"],
- "properties": {
- "$schema": {
- "description": "Mark this instance as conforming to resource description schema 1.x",
- "type": "string",
- "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_resource_description-1\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
- },
- "scripts": {
- "description": "Which files are resource's scripts and need to be installed",
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/file_ref_list_sha256",
- "default": []
- }
- }
- }]
-}
diff --git a/api_resource_description-2.schema.json b/api_resource_description-2.schema.json
new file mode 100644
index 0000000..1157977
--- /dev/null
+++ b/api_resource_description-2.schema.json
@@ -0,0 +1,35 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$id": "https://hydrilla.koszko.org/schemas/api_resource_description-2.schema.json",
+ "title": "Resource description",
+ "description": "Definition of a Hydrilla resource, as served through HTTP API",
+ "allOf": [{
+ "$ref": "./common_definitions-2.schema.json#/definitions/resource_definition_base"
+ }, {
+ "$ref": "./common_definitions-2.schema.json#/definitions/item_definition"
+ }, {
+ "type": "object",
+ "required": ["$schema", "type"],
+ "properties": {
+ "$schema": {
+ "description": "Mark this instance as conforming to resource description schema 2.x",
+ "type": "string",
+ "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_resource_description-2\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
+ },
+ "type": {
+ "description": "Identify this item as a resource",
+ "const": "resource"
+ },
+ "scripts": {
+ "description": "Which files are resource's scripts and need to be installed",
+ "$ref": "./common_definitions-2.schema.json#/definitions/file_ref_list_sha256",
+ "default": []
+ },
+ "dependencies": {
+ "description": "Which other resources this resource depends on",
+ "$ref": "./common_definitions-2.schema.json#/definitions/item_dep_specifier_array",
+ "default": []
+ }
+ }
+ }]
+}
diff --git a/api_resource_description-1.0.1.schema.json.license b/api_resource_description-2.schema.json.license
index f41d511..f41d511 100644
--- a/api_resource_description-1.0.1.schema.json.license
+++ b/api_resource_description-2.schema.json.license
diff --git a/api_source_description-1.0.1.schema.json b/api_source_description-2.schema.json
index 0744d1a..5bc0095 100644
--- a/api_source_description-1.0.1.schema.json
+++ b/api_source_description-2.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
- "$id": "https://hydrilla.koszko.org/schemas/api_source_description-1.0.1.schema.json",
+ "$id": "https://hydrilla.koszko.org/schemas/api_source_description-2.schema.json",
"title": "Source description",
"description": "Built description of a Hydrilla source package",
"type": "object",
@@ -14,16 +14,16 @@
],
"properties": {
"$schema": {
- "description": "Mark this instance as conforming to source description schema 1.x",
+ "description": "Mark this instance as conforming to source description schema 2.x",
"type": "string",
- "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_source_description-1\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
+ "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_source_description-2\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
},
"source_name": {
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/source_name"
+ "$ref": "./common_definitions-2.schema.json#/definitions/source_name"
},
"source_copyright": {
"description": "Which files indicate license terms of the source package",
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/file_ref_list_sha256"
+ "$ref": "./common_definitions-2.schema.json#/definitions/file_ref_list_sha256"
},
"source_archives": {
"description": "What archive extensions are available for this package's sources",
@@ -35,7 +35,7 @@
"required": ["sha256"],
"properties": {
"sha256": {
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/sha256"
+ "$ref": "./common_definitions-2.schema.json#/definitions/sha256"
}
}
},
@@ -50,17 +50,17 @@
"type": "string"
},
"comment": {
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/comment"
+ "$ref": "./common_definitions-2.schema.json#/definitions/comment"
},
"definitions": {
"description": "References to site resources and pattern->payload mappings",
"type": "array",
"items": {
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/typed_item_ref"
+ "$ref": "./common_definitions-2.schema.json#/definitions/typed_item_ref"
}
},
"generated_by": {
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/generated_by"
+ "$ref": "./common_definitions-2.schema.json#/definitions/generated_by"
}
}
}
diff --git a/api_source_description-1.0.1.schema.json.license b/api_source_description-2.schema.json.license
index f41d511..f41d511 100644
--- a/api_source_description-1.0.1.schema.json.license
+++ b/api_source_description-2.schema.json.license
diff --git a/common_definitions-1.0.1.schema.json b/common_definitions-2.schema.json
index b803188..1700f34 100644
--- a/common_definitions-1.0.1.schema.json
+++ b/common_definitions-2.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
- "$id": "https://hydrilla.koszko.org/schemas/common_definitions-1.0.1.schema.json",
+ "$id": "https://hydrilla.koszko.org/schemas/common_definitions-2.schema.json",
"title": "Common definitions",
"description": "Definitions used by other Hydrilla schemas",
"definitions": {
@@ -79,6 +79,13 @@
}
}
},
+ "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",
@@ -114,7 +121,7 @@
"item_definition_base": {
"description": "Definition of a resource/mapping (fields common to source definitions and built definitions)",
"allOf": [{
- "$ref": "#/definitions/typed_item_ref"
+ "$ref": "#/definitions/item_ref"
}, {
"type": "object",
"required": ["description"],
@@ -128,6 +135,37 @@
"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"
}
@@ -142,10 +180,6 @@
"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",
@@ -155,14 +189,6 @@
"description": "What scripts are included in the resource",
"$ref": "#/definitions/file_ref_list",
"default": []
- },
- "dependencies": {
- "description": "Which other resources this resource depends on",
- "type": "array",
- "items": {
- "$ref": "#/definitions/item_dep_specifier"
- },
- "default": []
}
}
}]
@@ -173,12 +199,7 @@
"$ref": "#/definitions/item_definition_base"
}, {
"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": {
diff --git a/common_definitions-1.0.1.schema.json.license b/common_definitions-2.schema.json.license
index f41d511..f41d511 100644
--- a/common_definitions-1.0.1.schema.json.license
+++ b/common_definitions-2.schema.json.license
diff --git a/package_source-2.schema.json b/package_source-2.schema.json
index 962a209..4d8249d 100644
--- a/package_source-2.schema.json
+++ b/package_source-2.schema.json
@@ -3,82 +3,58 @@
"$id": "https://hydrilla.koszko.org/schemas/package_source-2.schema.json",
"title": "Package source",
"description": "Definition of a Hydrilla source package",
- "allOf": [{
- "description": "Definition of a Hydrilla source package - validation rules common for all minor schema versions",
- "type": "object",
- "required": [
- "$schema",
- "source_name",
- "copyright",
- "upstream_url",
- "definitions"
- ],
- "properties": {
- "$schema": {
- "description": "Mark this instance as conforming to package source schema 1.x or 2.x",
- "type": "string",
- "pattern": "^https://hydrilla\\.koszko\\.org/schemas/package_source-[12]\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
- },
- "source_name": {
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/source_name"
- },
- "copyright": {
- "description": "Which files from the source package indicate its license terms and should be included in the distribution packages",
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/file_ref_list"
- },
- "upstream_url": {
- "description": "Where this software/work initially comes from",
- "type": "string"
- },
- "comment": {
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/comment"
- },
- "definitions": {
- "description": "Definitions of site resources and pattern->payload mappings",
- "type": "array",
- "items": {
- "anyOf": [{
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/resource_definition_base"
- }, {
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/mapping_definition_base"
- }]
- }
- },
- "additional_files": {
- "description": "Files which should be included in the source archive produced by Hydrilla builder in addition to script and copyright files",
- "$ref": "./common_definitions-1.0.1.schema.json#/definitions/file_ref_list",
- "default": []
- },
- "reuse_generate_spdx_report": {
- "description": "Should report.spdx be automatically generated for the package using REUSE tool",
- "type": "boolean",
- "default": false
- }
- }
- }, {
- "description": "Definition of a Hydrilla source package - validation rules common for versions 2 and higher",
- "if": {
- "type": "object",
- "properties": {
- "$schema": {
- "description": "Select instances that specify schema version 1.0.x",
- "type": "string",
- "pattern": "^https://hydrilla\\.koszko\\.org/schemas/package_source-2\\..*schema\\.json$"
- }
- }
+ "type": "object",
+ "required": [
+ "$schema",
+ "source_name",
+ "copyright",
+ "upstream_url",
+ "definitions"
+ ],
+ "properties": {
+ "$schema": {
+ "description": "Mark this instance as conforming to package source schema 2.x",
+ "type": "string",
+ "pattern": "^https://hydrilla\\.koszko\\.org/schemas/package_source-2\\.(([1-9][0-9]*|0)\\.)*schema\\.json$"
},
- "else": {
- "description": "Validate the piggybacking correctness",
- "type": "object",
- "properties": {
- "piggyback_on": {
- "anyOf": [{
- "$ref": "#/definitions/piggyback_apt"
- }]
- }
+ "source_name": {
+ "$ref": "./common_definitions-2.schema.json#/definitions/source_name"
+ },
+ "copyright": {
+ "description": "Which files from the source package indicate its license terms and should be included in the distribution packages",
+ "$ref": "./common_definitions-2.schema.json#/definitions/file_ref_list"
+ },
+ "upstream_url": {
+ "description": "Where this software/work initially comes from",
+ "type": "string"
+ },
+ "piggyback_on": {
+ "description": "Specify packages from other software system that should be used for constructing this package",
+ "anyOf": [{
+ "$ref": "#/definitions/piggyback_apt"
+ }]
+ },
+ "comment": {
+ "$ref": "./common_definitions-2.schema.json#/definitions/comment"
+ },
+ "definitions": {
+ "description": "Definitions of site resources and pattern->payload mappings (possibly combined together)",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/item_definition"
}
+ },
+ "additional_files": {
+ "description": "Files which should be included in the source archive produced by Hydrilla builder in addition to script and copyright files",
+ "$ref": "./common_definitions-2.schema.json#/definitions/file_ref_list",
+ "default": []
+ },
+ "reuse_generate_spdx_report": {
+ "description": "Should report.spdx be automatically generated for the package using REUSE tool",
+ "type": "boolean",
+ "default": false
}
- }],
+ },
"definitions": {
"piggyback_apt": {
"description": "Specify packages from APT software system that should be used for constructing this package",
@@ -136,6 +112,55 @@
"default": true
}
}
+ },
+ "item_definition": {
+ "description": "Definition of either a site resource, a pattern->payload mapping or both combined together",
+ "if": {
+ "type": "object",
+ "required": ["type"],
+ "properties": {
+ "type": {
+ "const": "resource"
+ }
+ }
+ },
+ "then": {
+ "$ref": "./common_definitions-2.schema.json#/definitions/resource_definition_base"
+ },
+ "else": {
+ "if": {
+ "type": "object",
+ "required": ["type"],
+ "properties": {
+ "type": {
+ "const": "mapping"
+ }
+ }
+ },
+ "then": {
+ "$ref": "./common_definitions-2.schema.json#/definitions/mapping_definition_base"
+ },
+ "else": {
+ "allOf": [{
+ "type": "object",
+ "required": ["type"],
+ "properties": {
+ "type": {
+ "const": "mapping_and_resource"
+ }
+ }
+ }, {
+ "$ref": "#/definitions/combined_mapping_resource_definition"
+ }]
+ }
+ }
+ },
+ "combined_mapping_resource_definition": {
+ "allOf": [{
+ "$ref": "./common_definitions-2.schema.json#/definitions/mapping_definition_base"
+ }, {
+ "$ref": "./common_definitions-2.schema.json#/definitions/resource_definition_base"
+ }]
}
}
}