From 5ff2121ef746483bcf5ad6e04464ed39068c2984 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Sat, 24 Feb 2024 13:17:58 +0000 Subject: [PATCH] fix: sdk.hideServer & sdk.hideClient --- app/controllers/api/account.php | 2 +- src/Appwrite/Specification/Format/Swagger2.php | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 37a6604c49..74650a2b18 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -400,7 +400,7 @@ App::get('/v1/account/tokens/oauth2/:provider') ->label('error', __DIR__ . '/../../views/general/error.phtml') ->label('scope', 'sessions.write') ->label('sdk.auth', []) - ->label('sdk.hideServer', true) + ->label('sdk.hideClient', true) ->label('sdk.namespace', 'account') ->label('sdk.method', 'createOAuth2Token') ->label('sdk.description', '/docs/references/account/create-token-oauth2.md') diff --git a/src/Appwrite/Specification/Format/Swagger2.php b/src/Appwrite/Specification/Format/Swagger2.php index 6fabde14cf..c098dc4709 100644 --- a/src/Appwrite/Specification/Format/Swagger2.php +++ b/src/Appwrite/Specification/Format/Swagger2.php @@ -150,10 +150,14 @@ class Swagger2 extends Format } if (empty($routeSecurity)) { - $sdkPlatforms[] = APP_PLATFORM_CLIENT; - $sdkPlatforms[] = APP_PLATFORM_SERVER; + if (!$route->getLabel('sdk.hideServer', false)) { + $sdkPlatforms[] = APP_PLATFORM_SERVER; + } + if (!$route->getLabel('sdk.hideClient', false)) { + $sdkPlatforms[] = APP_PLATFORM_CLIENT; + } } - + $temp = [ 'summary' => $route->getDesc(), 'operationId' => $route->getLabel('sdk.namespace', 'default') . ucfirst($method),