From 1d7ed046cbfe5b3be34faea02dd4df7ba6366c9f Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Sun, 7 Jun 2026 12:50:03 +0530 Subject: [PATCH] refactor: remove getProjectAuth(), use getLocationAuth()[0] directly in spec formatters --- src/Appwrite/SDK/Method.php | 5 ----- src/Appwrite/SDK/Specification/Format/OpenAPI3.php | 4 ++-- src/Appwrite/SDK/Specification/Format/Swagger2.php | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index e364c96163..f1b327513f 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -225,11 +225,6 @@ class Method return $this->additionalParameters; } - public function getProjectAuth(): string - { - return $this->locationAuth[0] ?? 'Project'; - } - public function getLocationAuth(): array { return $this->locationAuth; diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index cf83c3ea96..d9c2bf301e 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -188,7 +188,7 @@ class OpenAPI3 extends Format continue; } - $methodSecurities = [$methodObj->getProjectAuth() => []]; + $methodSecurities = [($methodObj->getLocationAuth()[0] ?? 'Project') => []]; foreach ($methodObj->getAuth() as $security) { if (\array_key_exists($security->value, $this->keys)) { $methodSecurities[$security->value] = []; @@ -374,7 +374,7 @@ class OpenAPI3 extends Format } if (!empty($scope)) { - $securities = [$sdk->getProjectAuth() => []]; + $securities = [($sdk->getLocationAuth()[0] ?? 'Project') => []]; foreach ($sdk->getAuth() as $security) { /** @var AuthType $security */ diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 0c4c423de1..b1541d5ddb 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -188,7 +188,7 @@ class Swagger2 extends Format continue; } - $methodSecurities = [$methodObj->getProjectAuth() => []]; + $methodSecurities = [($methodObj->getLocationAuth()[0] ?? 'Project') => []]; foreach ($methodObj->getAuth() as $security) { /** @var AuthType $security */ if (\array_key_exists($security->value, $this->keys)) { @@ -365,7 +365,7 @@ class Swagger2 extends Format } if (!empty($scope)) { - $securities = [$sdk->getProjectAuth() => []]; + $securities = [($sdk->getLocationAuth()[0] ?? 'Project') => []]; foreach ($sdk->getAuth() as $security) { if (\array_key_exists($security->value, $this->keys)) {