mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
fix: generate unique SDK names for multi-method routes
This commit is contained in:
2 files changed
+11
-2
No files matched your search
@@ -833,10 +833,17 @@ class OpenAPI3 extends Format
|
||||
}
|
||||
|
||||
$methods = $route->getMethods();
|
||||
foreach ($methods as $method) {
|
||||
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' => [
|
||||
|
||||
@@ -188,6 +188,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);
|
||||
|
||||
Reference in new issue
Block a user