From 7206db45f277c10c34d1b7ed9bd35343ac742d30 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Fri, 27 May 2022 15:46:34 +0200 Subject: 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. --- package_source-2.schema.json | 171 +++++++++++++++++++++++++------------------ 1 file changed, 98 insertions(+), 73 deletions(-) (limited to 'package_source-2.schema.json') 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" + }] } } } -- cgit v1.2.3