chore: fix hide
in specs
This commit is contained in:
parent
42e9865dff
commit
b650884351
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -330,7 +330,7 @@ App::get('/v1/account/sessions/oauth2/:provider')
|
|||
->label('error', __DIR__ . '/../../views/general/error.phtml')
|
||||
->label('scope', 'sessions.write')
|
||||
->label('sdk.auth', [])
|
||||
->label('sdk.hideServer', true)
|
||||
->label('sdk.hide', [APP_PLATFORM_SERVER])
|
||||
->label('sdk.namespace', 'account')
|
||||
->label('sdk.method', 'createOAuth2Session')
|
||||
->label('sdk.description', '/docs/references/account/create-session-oauth2.md')
|
||||
|
@ -400,7 +400,6 @@ App::get('/v1/account/tokens/oauth2/:provider')
|
|||
->label('error', __DIR__ . '/../../views/general/error.phtml')
|
||||
->label('scope', 'sessions.write')
|
||||
->label('sdk.auth', [])
|
||||
->label('sdk.hideClient', true)
|
||||
->label('sdk.namespace', 'account')
|
||||
->label('sdk.method', 'createOAuth2Token')
|
||||
->label('sdk.description', '/docs/references/account/create-token-oauth2.md')
|
||||
|
|
|
@ -168,34 +168,35 @@ class Specs extends Action
|
|||
|
||||
foreach ($appRoutes as $key => $method) {
|
||||
foreach ($method as $route) {
|
||||
$hide = $route->getLabel('sdk.hide', false);
|
||||
if ($hide === true || (\is_array($hide) && \in_array($platform, $hide))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @var \Utopia\Route $route */
|
||||
$routeSecurity = $route->getLabel('sdk.auth', []);
|
||||
$sdkPlaforms = [];
|
||||
$sdkPlatforms = [];
|
||||
|
||||
foreach ($routeSecurity as $value) {
|
||||
switch ($value) {
|
||||
case APP_AUTH_TYPE_SESSION:
|
||||
$sdkPlaforms[] = APP_PLATFORM_CLIENT;
|
||||
$sdkPlatforms[] = APP_PLATFORM_CLIENT;
|
||||
break;
|
||||
case APP_AUTH_TYPE_KEY:
|
||||
$sdkPlaforms[] = APP_PLATFORM_SERVER;
|
||||
$sdkPlatforms[] = APP_PLATFORM_SERVER;
|
||||
break;
|
||||
case APP_AUTH_TYPE_JWT:
|
||||
$sdkPlaforms[] = APP_PLATFORM_SERVER;
|
||||
$sdkPlatforms[] = APP_PLATFORM_SERVER;
|
||||
break;
|
||||
case APP_AUTH_TYPE_ADMIN:
|
||||
$sdkPlaforms[] = APP_PLATFORM_CONSOLE;
|
||||
$sdkPlatforms[] = APP_PLATFORM_CONSOLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($routeSecurity)) {
|
||||
if (!$route->getLabel('sdk.hideServer', false)) {
|
||||
$sdkPlatforms[] = APP_PLATFORM_SERVER;
|
||||
}
|
||||
if (!$route->getLabel('sdk.hideClient', false)) {
|
||||
$sdkPlatforms[] = APP_PLATFORM_CLIENT;
|
||||
}
|
||||
$sdkPlatforms[] = APP_PLATFORM_SERVER;
|
||||
$sdkPlatforms[] = APP_PLATFORM_CLIENT;
|
||||
}
|
||||
|
||||
if (!$route->getLabel('docs', true)) {
|
||||
|
@ -214,7 +215,7 @@ class Specs extends Action
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($platform !== APP_PLATFORM_CONSOLE && !\in_array($platforms[$platform], $sdkPlaforms)) {
|
||||
if ($platform !== APP_PLATFORM_CONSOLE && !\in_array($platforms[$platform], $sdkPlatforms)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -120,12 +120,8 @@ class OpenAPI3 extends Format
|
|||
foreach ($this->routes as $route) {
|
||||
$url = \str_replace('/v1', '', $route->getPath());
|
||||
$scope = $route->getLabel('scope', '');
|
||||
$hide = $route->getLabel('sdk.hide', false);
|
||||
$consumes = [$route->getLabel('sdk.request.type', 'application/json')];
|
||||
|
||||
if ($hide) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$method = $route->getLabel('sdk.method', 'unknown');
|
||||
$desc = (!empty($route->getLabel('sdk.description', ''))) ? \realpath(__DIR__ . '/../../../../' . $route->getLabel('sdk.description', '')) : null;
|
||||
|
@ -152,12 +148,8 @@ class OpenAPI3 extends Format
|
|||
}
|
||||
|
||||
if (empty($routeSecurity)) {
|
||||
if (!$route->getLabel('sdk.hideServer', false)) {
|
||||
$sdkPlatforms[] = APP_PLATFORM_SERVER;
|
||||
}
|
||||
if (!$route->getLabel('sdk.hideClient', false)) {
|
||||
$sdkPlatforms[] = APP_PLATFORM_CLIENT;
|
||||
}
|
||||
$sdkPlatforms[] = APP_PLATFORM_SERVER;
|
||||
$sdkPlatforms[] = APP_PLATFORM_CLIENT;
|
||||
}
|
||||
|
||||
$temp = [
|
||||
|
|
|
@ -118,13 +118,8 @@ class Swagger2 extends Format
|
|||
/** @var \Utopia\Route $route */
|
||||
$url = \str_replace('/v1', '', $route->getPath());
|
||||
$scope = $route->getLabel('scope', '');
|
||||
$hide = $route->getLabel('sdk.hide', false);
|
||||
$consumes = [$route->getLabel('sdk.request.type', 'application/json')];
|
||||
|
||||
if ($hide) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$method = $route->getLabel('sdk.method', 'unknown');
|
||||
$desc = (!empty($route->getLabel('sdk.description', ''))) ? \realpath(__DIR__ . '/../../../../' . $route->getLabel('sdk.description', '')) : null;
|
||||
$produces = $route->getLabel('sdk.response.type', null);
|
||||
|
@ -150,12 +145,8 @@ class Swagger2 extends Format
|
|||
}
|
||||
|
||||
if (empty($routeSecurity)) {
|
||||
if (!$route->getLabel('sdk.hideServer', false)) {
|
||||
$sdkPlatforms[] = APP_PLATFORM_SERVER;
|
||||
}
|
||||
if (!$route->getLabel('sdk.hideClient', false)) {
|
||||
$sdkPlatforms[] = APP_PLATFORM_CLIENT;
|
||||
}
|
||||
$sdkPlatforms[] = APP_PLATFORM_SERVER;
|
||||
$sdkPlatforms[] = APP_PLATFORM_CLIENT;
|
||||
}
|
||||
|
||||
$temp = [
|
||||
|
|
Loading…
Reference in a new issue