diff --git a/composer.json b/composer.json index c642629dad..b39c68617c 100644 --- a/composer.json +++ b/composer.json @@ -82,7 +82,7 @@ "utopia-php/locale": "0.8.*", "utopia-php/lock": "0.2.*", "utopia-php/logger": "0.8.*", - "utopia-php/messaging": "^1.2", + "utopia-php/messaging": "^1.3", "utopia-php/migration": "1.17.*", "utopia-php/platform": "^1.0@RC", "utopia-php/pools": "1.*", diff --git a/composer.lock b/composer.lock index 6c58cd1dc8..ca73fc33d4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "41a52a948a7a1de84e507722f3da2336", + "content-hash": "188ecad278dfe1db8beef12790f11843", "packages": [ { "name": "adhocore/jwt", @@ -4459,16 +4459,16 @@ }, { "name": "utopia-php/messaging", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/utopia-php/messaging.git", - "reference": "3419ffbbeb242b3232b588430bd465024959720c" + "reference": "63a27be589fd998ad8489d66e570640c7cce9425" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/messaging/zipball/3419ffbbeb242b3232b588430bd465024959720c", - "reference": "3419ffbbeb242b3232b588430bd465024959720c", + "url": "https://api.github.com/repos/utopia-php/messaging/zipball/63a27be589fd998ad8489d66e570640c7cce9425", + "reference": "63a27be589fd998ad8489d66e570640c7cce9425", "shasum": "" }, "require": { @@ -4505,9 +4505,9 @@ ], "support": { "issues": "https://github.com/utopia-php/messaging/issues", - "source": "https://github.com/utopia-php/messaging/tree/1.2.0" + "source": "https://github.com/utopia-php/messaging/tree/1.3.0" }, - "time": "2026-06-23T04:24:43+00:00" + "time": "2026-07-14T07:21:08+00:00" }, { "name": "utopia-php/migration", diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 499c5c3474..a308974f3e 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -832,11 +832,18 @@ class OpenAPI3 extends Format $url = \implode('/', $segments); } - $methods = $route->getMethods(); - foreach ($methods as $method) { + $methods = \array_values($route->getMethods()); + foreach ($methods as $index => $method) { $methodTemp = $temp; if (\count($methods) > 1) { - $methodTemp['operationId'] .= \ucfirst(\strtolower($method)); + $suffix = \ucfirst(\strtolower($method)); + $methodTemp['operationId'] .= $suffix; + + // Keep the first method's SDK name stable while ensuring + // additional HTTP methods generate unique SDK methods. + if ($index > 0) { + $methodTemp['x-appwrite']['method'] .= $suffix; + } } $body = [ 'content' => [ diff --git a/tests/unit/SDK/Specification/FormatTest.php b/tests/unit/SDK/Specification/FormatTest.php index 4932022c56..4b7edf0c28 100644 --- a/tests/unit/SDK/Specification/FormatTest.php +++ b/tests/unit/SDK/Specification/FormatTest.php @@ -168,7 +168,12 @@ final class FormatTest extends TestCase Method::$processed = []; Method::$errors = []; - $route = (new Route(['GET', 'POST'], '/v1/tests/:testId')) + $route = (new class (['GET', 'POST'], '/v1/tests/:testId') extends Route { + public function getMethods(): array + { + return [2 => 'GET', 4 => 'POST']; + } + }) ->desc('Get or update test') ->label('sdk', new Method( namespace: 'test', @@ -188,6 +193,8 @@ final class FormatTest extends TestCase $this->assertSame('testGetOrUpdateTestGet', $get['operationId']); $this->assertSame('testGetOrUpdateTestPost', $post['operationId']); + $this->assertSame('getOrUpdateTest', $get['x-appwrite']['method']); + $this->assertSame('getOrUpdateTestPost', $post['x-appwrite']['method']); $this->assertSame('path', $get['parameters'][0]['in']); $this->assertSame('query', $get['parameters'][1]['in']); $this->assertArrayNotHasKey('requestBody', $get);