1
0
Fork 0
mirror of synced 2024-06-25 17:50:38 +12:00

Split for client and servers SDKs

This commit is contained in:
Eldad Fux 2020-01-28 14:56:09 +02:00
parent 45ee43064a
commit b5a73340c2
2 changed files with 17 additions and 0 deletions

View file

@ -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);

View file

@ -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(