From 9437122accd086ba32fd9179d0370fd4fd825f9f Mon Sep 17 00:00:00 2001 From: Rob Bast Date: Fri, 30 Sep 2016 17:02:18 +0200 Subject: [PATCH] composer repository json schema --- res/composer-repository-schema.json | 99 +++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 res/composer-repository-schema.json diff --git a/res/composer-repository-schema.json b/res/composer-repository-schema.json new file mode 100644 index 000000000..cacca3819 --- /dev/null +++ b/res/composer-repository-schema.json @@ -0,0 +1,99 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "A representation of packages metadata.", + "type": "object", + "oneOf": [ + { "required": [ "packages" ] }, + { "required": [ "providers" ] }, + { "required": [ "provider-includes", "providers-url" ] } + ], + "properties": { + "packages": { + "type": ["object", "array"], + "description": "A hashmap of package names in the form of /.", + "additionalProperties": { "$ref": "#/definitions/versions" } + }, + "providers-url": { + "type": "string", + "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'." + }, + "provider-includes": { + "type": "object", + "description": "A hashmap of provider listings.", + "additionalProperties": { "$ref": "#/definitions/provider" } + }, + "providers": { + "type": "object", + "description": "A hashmap of package names in the form of /.", + "additionalProperties": { "$ref": "#/definitions/provider" } + }, + "notify-batch": { + "type": "string", + "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'." + }, + "search": { + "type": "string", + "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'." + }, + "warning": { + "type": "string", + "description": "A message that will be output by Composer as a warning when this source is consulted." + } + }, + "definitions": { + "versions": { + "type": "object", + "description": "A hashmap of versions and their metadata.", + "additionalProperties": { "$ref": "#/definitions/version" } + }, + "version": { + "type": "object", + "oneOf": [ + { "$ref": "#/definitions/package-generic" }, + { "$ref": "#/definitions/package-metapackage" } + ] + }, + "package-generic": { + "properties": { + "name": { "type": "string" }, + "type": { "type": "string" }, + "version": { "type": "string" }, + "version_normalized": { + "type": "string", + "description": "Normalized version, optional but can save computational time on client side." + }, + "source": { "type": "object" }, + "dist": { "type": "object" }, + "time": { "type": "string" } + }, + "oneOf": [ + { "required": [ "name", "version", "source" ] }, + { "required": [ "name", "version", "dist" ] } + ], + "additionalProperties": true + }, + "package-metapackage": { + "properties": { + "name": { "type": "string" }, + "type": { "type": "string", "enum": [ "metapackage" ] }, + "version": { "type": "string" }, + "version_normalized": { + "type": "string", + "description": "Normalized version, optional but can save computational time on client side." + }, + "time": { "type": "string" } + }, + "required": [ "name", "version" ], + "additionalProperties": true + }, + "provider": { + "type": "object", + "properties": { + "sha256": { + "type": "string", + "description": "Hash value that can be used to validate the resource." + } + } + } + } +}