From 95dbb6d9db662589b9776e502e2c630d17efb755 Mon Sep 17 00:00:00 2001 From: Rob Bast Date: Thu, 28 May 2015 13:03:24 +0200 Subject: [PATCH] add docs to support section in composer schema, closes #4055 Note that this does not yet add this attribute @ packagist though --- doc/04-schema.md | 7 ++++--- res/composer-schema.json | 11 ++++++++--- src/Composer/Package/Loader/ValidatingArrayLoader.php | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/doc/04-schema.md b/doc/04-schema.md index 86c344cd3..5a53bd7d6 100644 --- a/doc/04-schema.md +++ b/doc/04-schema.md @@ -235,11 +235,12 @@ Various information to get support about the project. Support information includes the following: * **email:** Email address for support. -* **issues:** URL to the Issue Tracker. -* **forum:** URL to the Forum. -* **wiki:** URL to the Wiki. +* **issues:** URL to the issue tracker. +* **forum:** URL to the forum. +* **wiki:** URL to the wiki. * **irc:** IRC channel for support, as irc://server/channel. * **source:** URL to browse or download the sources. +* **docs:** URL to the documentation. An example: diff --git a/res/composer-schema.json b/res/composer-schema.json index 582788271..fa0f5ce12 100644 --- a/res/composer-schema.json +++ b/res/composer-schema.json @@ -390,17 +390,17 @@ }, "issues": { "type": "string", - "description": "URL to the Issue Tracker.", + "description": "URL to the issue tracker.", "format": "uri" }, "forum": { "type": "string", - "description": "URL to the Forum.", + "description": "URL to the forum.", "format": "uri" }, "wiki": { "type": "string", - "description": "URL to the Wiki.", + "description": "URL to the wiki.", "format": "uri" }, "irc": { @@ -412,6 +412,11 @@ "type": "string", "description": "URL to browse or download the sources.", "format": "uri" + }, + "docs": { + "type": "string", + "description": "URL to the documentation.", + "format": "uri" } } }, diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index 65655c4a6..c3377019b 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -121,7 +121,7 @@ class ValidatingArrayLoader implements LoaderInterface } if ($this->validateArray('support') && !empty($this->config['support'])) { - foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc') as $key) { + foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs') as $key) { if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) { $this->errors[] = 'support.'.$key.' : invalid value, must be a string'; unset($this->config['support'][$key]); @@ -138,7 +138,7 @@ class ValidatingArrayLoader implements LoaderInterface unset($this->config['support']['irc']); } - foreach (array('issues', 'forum', 'wiki', 'source') as $key) { + foreach (array('issues', 'forum', 'wiki', 'source', 'docs') as $key) { if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) { $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL'; unset($this->config['support'][$key]);