mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Merge remote-tracking branch 'upstream/1.8.x' into dat-600
This commit is contained in:
@@ -122,6 +122,19 @@ class Maintenance extends Action
|
||||
Console::info("[{$time}] Found " . \count($certificates) . " certificates for renewal, scheduling jobs.");
|
||||
|
||||
foreach ($certificates as $certificate) {
|
||||
$domain = $certificate->getAttribute('domain');
|
||||
if (System::getEnv('_APP_RULES_FORMAT') === 'md5') {
|
||||
$rule = $dbForPlatform->getDocument('rules', md5($domain));
|
||||
} else {
|
||||
$rule = $dbForPlatform->findOne('rules', [
|
||||
Query::equal('domain', [$domain]),
|
||||
]);
|
||||
}
|
||||
|
||||
if ($rule->isEmpty() || $rule->getAttribute('region') !== System::getEnv('_APP_REGION', 'default')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$queueForCertificate
|
||||
->setDomain(new Document([
|
||||
'domain' => $certificate->getAttribute('domain')
|
||||
|
||||
@@ -119,7 +119,7 @@ class SDKs extends Action
|
||||
$gettingStarted = ($gettingStarted) ? \file_get_contents($gettingStarted) : '';
|
||||
$examples = \realpath(__DIR__ . '/../../../../docs/sdks/' . $language['key'] . '/EXAMPLES.md');
|
||||
$examples = ($examples) ? \file_get_contents($examples) : '';
|
||||
$changelog = \realpath(__DIR__ . '/../../../../docs/sdks/' . $language['key'] . '/CHANGELOG.md');
|
||||
$changelog = $language['changelog'] ?? '';
|
||||
$changelog = ($changelog) ? \file_get_contents($changelog) : '# Change Log';
|
||||
$warning = '**This SDK is compatible with Appwrite server version ' . $version . '. For older versions, please check [previous releases](' . $language['url'] . '/releases).**';
|
||||
$license = 'BSD-3-Clause';
|
||||
|
||||
@@ -632,6 +632,7 @@ class OpenAPI3 extends Format
|
||||
|
||||
$required = $model->getRequired();
|
||||
$rules = $model->getRules();
|
||||
$examples = [];
|
||||
|
||||
$output['components']['schemas'][$model->getType()] = [
|
||||
'description' => $model->getName(),
|
||||
@@ -655,6 +656,8 @@ class OpenAPI3 extends Format
|
||||
$format = null;
|
||||
$items = null;
|
||||
|
||||
$examples[$name] = $rule['example'] ?? null;
|
||||
|
||||
switch ($rule['type']) {
|
||||
case 'string':
|
||||
case 'datetime':
|
||||
@@ -743,6 +746,12 @@ class OpenAPI3 extends Format
|
||||
$output['components']['schemas'][$model->getType()]['properties'][$name]['nullable'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($model->isAny() && !empty($model->getSampleData())) {
|
||||
$examples = array_merge($examples, $model->getSampleData());
|
||||
}
|
||||
|
||||
$output['components']['schemas'][$model->getType()]['example'] = $examples;
|
||||
}
|
||||
|
||||
\ksort($output['paths']);
|
||||
|
||||
@@ -642,6 +642,7 @@ class Swagger2 extends Format
|
||||
|
||||
$required = $model->getRequired();
|
||||
$rules = $model->getRules();
|
||||
$examples = [];
|
||||
|
||||
$output['definitions'][$model->getType()] = [
|
||||
'description' => $model->getName(),
|
||||
@@ -665,6 +666,8 @@ class Swagger2 extends Format
|
||||
$format = null;
|
||||
$items = null;
|
||||
|
||||
$examples[$name] = $rule['example'] ?? null;
|
||||
|
||||
switch ($rule['type']) {
|
||||
case 'string':
|
||||
case 'datetime':
|
||||
@@ -762,6 +765,12 @@ class Swagger2 extends Format
|
||||
$output['definitions'][$model->getType()]['properties'][$name]['x-nullable'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($model->isAny() && !empty($model->getSampleData())) {
|
||||
$examples = array_merge($examples, $model->getSampleData());
|
||||
}
|
||||
|
||||
$output['definitions'][$model->getType()]['example'] = $examples;
|
||||
}
|
||||
|
||||
\ksort($output['paths']);
|
||||
|
||||
@@ -31,4 +31,14 @@ class Any extends Model
|
||||
{
|
||||
return Response::MODEL_ANY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sample data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSampleData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,4 +95,15 @@ class Document extends Any
|
||||
|
||||
return $document;
|
||||
}
|
||||
|
||||
public function getSampleData(): array
|
||||
{
|
||||
return [
|
||||
'username' => 'john.doe',
|
||||
'email' => 'john.doe@example.com',
|
||||
'fullName' => 'John Doe',
|
||||
'age' => 30,
|
||||
'isAdmin' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,13 @@ class Preferences extends Any
|
||||
{
|
||||
return Response::MODEL_PREFERENCES;
|
||||
}
|
||||
|
||||
public function getSampleData(): array
|
||||
{
|
||||
return [
|
||||
'language' => 'en',
|
||||
'timezone' => 'UTC',
|
||||
'darkTheme' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user