Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/Appwrite/Platform/Tasks/Specs.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ public function getResponse(): UtopiaResponse
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)
};
Comment thread
ChiragAgg5k marked this conversation as resolved.
}

public function __construct()
{
$this
Expand Down Expand Up @@ -288,12 +297,7 @@ public function action(string $version, string $mode): void
];

foreach (['swagger2', 'open-api3'] as $format) {
$formatInstance = match ($format) {
'swagger2' => new Swagger2(...$arguments),
'open-api3' => new OpenAPI3(...$arguments),
default => throw new Exception('Format not found: ' . $format)
};

$formatInstance = $this->getFormatInstance($format, $arguments);
$specs = new Specification($formatInstance);
$endpoint = System::getEnv('_APP_HOME', '[HOSTNAME]');
$email = System::getEnv('_APP_SYSTEM_TEAM_EMAIL', APP_EMAIL_TEAM);
Expand Down