From 93222bf3f9c36b422e89d038cb55a336eee4b477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Sat, 26 Oct 2024 20:47:43 +0200 Subject: [PATCH] Fix response format; formatting --- app/config/frameworks.php | 7 ++++--- .../Modules/Sites/Http/Sites/CreateSite.php | 1 - .../Utopia/Response/Model/Framework.php | 21 +++++++++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/config/frameworks.php b/app/config/frameworks.php index c553636d48..b4f3998851 100644 --- a/app/config/frameworks.php +++ b/app/config/frameworks.php @@ -4,7 +4,7 @@ * List of Appwrite Sites supported frameworks */ - const TEMPLATE_RUNTIMES = [ +const TEMPLATE_RUNTIMES = [ 'NODE' => [ 'name' => 'node', 'versions' => ['22', '21.0', '20.0', '19.0', '18.0', '16.0', '14.5'] @@ -39,11 +39,12 @@ ], ]; - function getVersions(array $versions, string $prefix) { +function getVersions(array $versions, string $prefix) +{ return array_map(function ($version) use ($prefix) { return $prefix . '-' . $version; }, $versions); - } +} return [ 'sveltekit' => [ diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/CreateSite.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/CreateSite.php index 6c62f02fe6..65666dddd1 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/CreateSite.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/CreateSite.php @@ -23,7 +23,6 @@ use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Swoole\Request; use Utopia\System\System; -use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; diff --git a/src/Appwrite/Utopia/Response/Model/Framework.php b/src/Appwrite/Utopia/Response/Model/Framework.php index ddd6322553..b23e73896a 100644 --- a/src/Appwrite/Utopia/Response/Model/Framework.php +++ b/src/Appwrite/Utopia/Response/Model/Framework.php @@ -34,17 +34,30 @@ class Framework extends Model 'default' => '', 'example' => 'sveltekit.png', ]) - ->addRule('defaultRuntime', [ + ->addRule('defaultServeRuntime', [ 'type' => self::TYPE_STRING, 'description' => 'Default runtime version.', 'default' => '', - 'example' => 'node-20.0', + 'example' => 'static-1', ]) - ->addRule('runtimes', [ + ->addRule('serveRuntimes', [ 'type' => self::TYPE_STRING, 'description' => 'List of supported runtime versions.', 'default' => '', - 'example' => 'node-16.0', + 'example' => 'static-1', + 'array' => true, + ]) + ->addRule('defaultBuildRuntime', [ + 'type' => self::TYPE_STRING, + 'description' => 'Default runtime version.', + 'default' => '', + 'example' => 'node-22', + ]) + ->addRule('buildRuntimes', [ + 'type' => self::TYPE_STRING, + 'description' => 'List of supported runtime versions.', + 'default' => '', + 'example' => 'node-21.0', 'array' => true, ]) ;