From 955194f8969bdbf110475f3eda604f869d059133 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 31 May 2022 13:24:38 +0200 Subject: [PATCH 1/4] docs: Fix inconsist semver operator suggestion (#10810) Using caret over tilde is better since it behaves the same as in npm: https://jubianchi.github.io/semver-check/#/constraint/~3.0 But when this change was introduced in https://github.com/composer/composer/pull/5396, it was not complete. --- doc/faqs/why-are-unbound-version-constraints-a-bad-idea.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/faqs/why-are-unbound-version-constraints-a-bad-idea.md b/doc/faqs/why-are-unbound-version-constraints-a-bad-idea.md index 2039fa81b..d9df4e5d8 100644 --- a/doc/faqs/why-are-unbound-version-constraints-a-bad-idea.md +++ b/doc/faqs/why-are-unbound-version-constraints-a-bad-idea.md @@ -12,7 +12,7 @@ The only good alternative is to define an upper bound on your constraints, which you can increase in a new release after testing that your package is compatible with the new major version of your dependency. -For example instead of using `>=3.4` you should use `~3.4` which allows all +For example instead of using `>=3.4` you should use `^3.4` which allows all versions up to `3.999` but does not include `4.0` and above. The `^` operator works very well with libraries following [semantic versioning](https://semver.org). From 313142c6cd64ac5d7d37aaa327ee244068512b03 Mon Sep 17 00:00:00 2001 From: Matronator <5470780+matronator@users.noreply.github.com> Date: Tue, 31 May 2022 01:44:07 +0200 Subject: [PATCH 2/4] Escape forward slash in `properties.name` --- res/composer-schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/composer-schema.json b/res/composer-schema.json index e4e460b89..b09c095cc 100644 --- a/res/composer-schema.json +++ b/res/composer-schema.json @@ -6,7 +6,7 @@ "name": { "type": "string", "description": "Package name, including 'vendor-name/' prefix.", - "pattern": "^[a-z0-9]([_.-]?[a-z0-9]++)*+/[a-z0-9](([_.]|-{1,2})?[a-z0-9]++)*+$" + "pattern": "^[a-z0-9]([_.-]?[a-z0-9]++)*+\/[a-z0-9](([_.]|-{1,2})?[a-z0-9]++)*+$" }, "description": { "type": "string", From 70a7b592e994cc8c042e3c869af34ff1e72db777 Mon Sep 17 00:00:00 2001 From: Nicolas Hedger <649677+nhedger@users.noreply.github.com> Date: Wed, 1 Jun 2022 21:23:07 +0200 Subject: [PATCH 3/4] Fix JSON schema regex pattern (#10811) --- res/composer-schema.json | 2 +- tests/Composer/Test/Json/ComposerSchemaTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/res/composer-schema.json b/res/composer-schema.json index b09c095cc..9516e4590 100644 --- a/res/composer-schema.json +++ b/res/composer-schema.json @@ -6,7 +6,7 @@ "name": { "type": "string", "description": "Package name, including 'vendor-name/' prefix.", - "pattern": "^[a-z0-9]([_.-]?[a-z0-9]++)*+\/[a-z0-9](([_.]|-{1,2})?[a-z0-9]++)*+$" + "pattern": "^[a-z0-9]([_.-]?[a-z0-9]+)*\/[a-z0-9](([_.]|-{1,2})?[a-z0-9]+)*$" }, "description": { "type": "string", diff --git a/tests/Composer/Test/Json/ComposerSchemaTest.php b/tests/Composer/Test/Json/ComposerSchemaTest.php index 8c252a046..2cda98e4e 100644 --- a/tests/Composer/Test/Json/ComposerSchemaTest.php +++ b/tests/Composer/Test/Json/ComposerSchemaTest.php @@ -25,9 +25,9 @@ class ComposerSchemaTest extends TestCase $expectedError = array( array( 'property' => 'name', - 'message' => 'Does not match the regex pattern ^[a-z0-9]([_.-]?[a-z0-9]++)*+/[a-z0-9](([_.]|-{1,2})?[a-z0-9]++)*+$', + 'message' => 'Does not match the regex pattern ^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]|-{1,2})?[a-z0-9]+)*$', 'constraint' => 'pattern', - 'pattern' => '^[a-z0-9]([_.-]?[a-z0-9]++)*+/[a-z0-9](([_.]|-{1,2})?[a-z0-9]++)*+$', + 'pattern' => '^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]|-{1,2})?[a-z0-9]+)*$', ), ); From 3ead6c01197da9ec0793a9d7669cae8e2befdb8b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 1 Jun 2022 21:32:29 +0200 Subject: [PATCH 4/4] Backport schema fixes for gitlab-token, fixes #10800 --- res/composer-schema.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/res/composer-schema.json b/res/composer-schema.json index 9516e4590..f3f0ca2a9 100644 --- a/res/composer-schema.json +++ b/res/composer-schema.json @@ -349,7 +349,18 @@ "type": "object", "description": "An object of domain name => gitlab private tokens, typically {\"gitlab.com\":\"\"}.", "additionalProperties": { - "type": "string" + "type": ["string", "object"], + "required": ["username", "token"], + "properties": { + "username": { + "type": "string", + "description": "The username used for GitLab authentication" + }, + "token": { + "type": "string", + "description": "The token used for GitLab authentication" + } + } } }, "gitlab-protocol": {