diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-02-08 16:07:10 +0100 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-02-09 13:34:46 +0100 |
commit | c72c8438875d20b156d22d975523a19bbb407d95 (patch) | |
tree | 5645719cd926b80a4c736e65587818249cde4fed /package_source-1.schema.json | |
parent | ca1de2ed4a69a71f2f75552ade693d04ea1baa85 (diff) | |
download | hydrilla-json-schemas-c72c8438875d20b156d22d975523a19bbb407d95.tar.gz hydrilla-json-schemas-c72c8438875d20b156d22d975523a19bbb407d95.zip |
refactor some definitions into a separate file and add schemas for API endpoints
Diffstat (limited to 'package_source-1.schema.json')
-rw-r--r-- | package_source-1.schema.json | 176 |
1 files changed, 8 insertions, 168 deletions
diff --git a/package_source-1.schema.json b/package_source-1.schema.json index 3a0ce03..392183d 100644 --- a/package_source-1.schema.json +++ b/package_source-1.schema.json @@ -13,106 +13,36 @@ ], "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 + "$ref": "./common_definitions-1.schema.json#/definitions/schema_version" }, "source_name": { - "description": "Unique identifier of this source package", - "type": "string", - "pattern": "^[-0-9a-z.]+$" + "$ref": "./common_definitions-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", - "type": "array", - "items": { - "$ref": "#/definitions/file_ref" - } + "$ref": "./common_definitions-1.schema.json#/definitions/file_ref_list" }, "upstream_url": { "description": "Where this software/work initially comes from", "type": "string" }, "comment": { - "$ref": "#/definitions/comment" + "$ref": "./common_definitions-1.schema.json#/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": "./common_definitions-1.schema.json#/definitions/resource_definition_base" }, { - "anyOf": [{ - "$ref": "#/definitions/resource_definition" - }, { - "$ref": "#/definitions/mapping_definition" - }] + "$ref": "./common_definitions-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", - "type": "array", - "items": { - "$ref": "#/definitions/file_ref" - }, + "$ref": "./common_definitions-1.schema.json#/definitions/file_ref_list", "default": [] }, "reuse_generate_spdx_report": { @@ -120,95 +50,5 @@ "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" - } - }] - } - } - } } } |