refactor: remove getProjectAuth(), use getLocationAuth()[0] directly in spec formatters

This commit is contained in:
harsh mahajan committed 2026-06-07 12:50:03 +05:30
1 parent c3c8fb5b9f
commit 1d7ed046cb
3 files changed
+4 -9

No files matched your search

-5
View File
@@ -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;
@@ -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 */
@@ -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)) {