diff --git a/app/app.php b/app/app.php index af3e07f0e..45e2e98bd 100644 --- a/app/app.php +++ b/app/app.php @@ -452,6 +452,11 @@ $utopia->get('/v1/open-api-2.json') 'server' => ['Project' => [], 'Key' => []], ]; + $platforms = [ + 'client' => APP_PLATFORM_CLIENT, + 'server' => APP_PLATFORM_SERVER, + ]; + /* * Specifications (v3.0.0): * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md @@ -549,6 +554,13 @@ $utopia->get('/v1/open-api-2.json') ], ]; + if ($extensions) { + $output['securityDefinitions']['Project']['extensions'] = ['demo' => '5df5acd0d48c2']; + $output['securityDefinitions']['Key']['extensions'] = ['demo' => '919c2d18fb5d4...a2ae413da83346ad2']; + $output['securityDefinitions']['Locale']['extensions'] = ['demo' => 'en']; + $output['securityDefinitions']['Mode']['extensions'] = ['demo' => '']; + } + foreach ($utopia->getRoutes() as $key => $method) { foreach ($method as $route) { /* @var $route \Utopia\Route */ if (!$route->getLabel('docs', true)) { @@ -559,6 +571,10 @@ $utopia->get('/v1/open-api-2.json') continue; } + if(!in_array($platforms[$platform], $route->getLabel('sdk.platform', []))) { + continue; + } + $url = str_replace('/v1', '', $route->getURL()); $scope = $route->getLabel('scope', ''); $hide = $route->getLabel('sdk.hide', false); diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index f052040b9..7c7871290 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -48,6 +48,7 @@ $utopia->get('/v1/account') ->label('sdk.namespace', 'account') ->label('sdk.method', 'getAccount') ->label('sdk.description', '/docs/references/account/get.md') + ->label('sdk.response', ['200' => 'user']) ->action( function () use ($response, &$user, $oauthKeys) { $response->json(array_merge($user->getArrayCopy(array_merge(