diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index ead6542848..a308974f3e 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -832,7 +832,7 @@ class OpenAPI3 extends Format $url = \implode('/', $segments); } - $methods = $route->getMethods(); + $methods = \array_values($route->getMethods()); foreach ($methods as $index => $method) { $methodTemp = $temp; if (\count($methods) > 1) { diff --git a/tests/unit/SDK/Specification/FormatTest.php b/tests/unit/SDK/Specification/FormatTest.php index 87f555b35a..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',