diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 443260ea90..f70895ad60 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -436,8 +436,8 @@ App::get('/v1/functions/runtimes') continue; } - $runtimes[$key]['$id'] = $key; - $allowed[] = $runtimes[$key]; + $runtime['$id'] = $key; + $allowed[] = $runtime; } $response->dynamic(new Document([ diff --git a/src/Appwrite/Utopia/Response/Model/Runtime.php b/src/Appwrite/Utopia/Response/Model/Runtime.php index 8bc42cb418..3c328c4d40 100644 --- a/src/Appwrite/Utopia/Response/Model/Runtime.php +++ b/src/Appwrite/Utopia/Response/Model/Runtime.php @@ -16,6 +16,12 @@ class Runtime extends Model 'default' => '', 'example' => 'python-3.8', ]) + ->addRule('key', [ + 'type' => self::TYPE_STRING, + 'description' => 'Parent runtime key.', + 'default' => '', + 'example' => 'python', + ]) ->addRule('name', [ 'type' => self::TYPE_STRING, 'description' => 'Runtime Name.', diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index e3148752c8..3e6a00a4cb 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -1412,6 +1412,7 @@ class FunctionsCustomServerTest extends Scope $this->assertArrayHasKey('$id', $runtime); $this->assertArrayHasKey('name', $runtime); + $this->assertArrayHasKey('key', $runtime); $this->assertArrayHasKey('version', $runtime); $this->assertArrayHasKey('logo', $runtime); $this->assertArrayHasKey('image', $runtime);