mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
chore: custom format instance in specs
This commit is contained in:
parent
275ff3dbf2
commit
c2645be4e1
1 changed files with 10 additions and 6 deletions
|
|
@ -43,6 +43,15 @@ class Specs extends Action
|
||||||
return new AppwriteResponse(new SwooleResponse());
|
return new AppwriteResponse(new SwooleResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getFormatInstance(string $format, array $arguments)
|
||||||
|
{
|
||||||
|
return match ($format) {
|
||||||
|
'swagger2' => new Swagger2(...$arguments),
|
||||||
|
'open-api3' => new OpenAPI3(...$arguments),
|
||||||
|
default => throw new Exception('Format not found: ' . $format)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
|
@ -288,12 +297,7 @@ class Specs extends Action
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach (['swagger2', 'open-api3'] as $format) {
|
foreach (['swagger2', 'open-api3'] as $format) {
|
||||||
$formatInstance = match ($format) {
|
$formatInstance = $this->getFormatInstance($format, $arguments);
|
||||||
'swagger2' => new Swagger2(...$arguments),
|
|
||||||
'open-api3' => new OpenAPI3(...$arguments),
|
|
||||||
default => throw new Exception('Format not found: ' . $format)
|
|
||||||
};
|
|
||||||
|
|
||||||
$specs = new Specification($formatInstance);
|
$specs = new Specification($formatInstance);
|
||||||
$endpoint = System::getEnv('_APP_HOME', '[HOSTNAME]');
|
$endpoint = System::getEnv('_APP_HOME', '[HOSTNAME]');
|
||||||
$email = System::getEnv('_APP_SYSTEM_TEAM_EMAIL', APP_EMAIL_TEAM);
|
$email = System::getEnv('_APP_SYSTEM_TEAM_EMAIL', APP_EMAIL_TEAM);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue