From 7a995fe7591d4280bc3e2af85ec34cb095dfff8e Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 9 Apr 2026 16:25:59 +0530 Subject: [PATCH] Revert "Merge pull request #11795 from rathi-yash/fix-11765-global-variable-creation" This reverts commit 597b20a6cb2eb3cc93a5a25814f2ec39b35cd3cd, reversing changes made to 20f80ac067e0042ea05ac9566f0a9ff1624bf3b2. --- .../Project/Http/Project/Variables/Create.php | 2 +- .../Projects/ProjectsConsoleClientTest.php | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Create.php index 7b6dc67b4f..8dbc720045 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Create.php @@ -53,7 +53,7 @@ class Create extends Action ) ], )) - ->param('variableId', 'unique()', fn (Database $dbForProject) => new CustomId(false, $dbForProject->getAdapter()->getMaxUIDLength()), 'Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.', true, ['dbForProject']) + ->param('variableId', '', fn (Database $dbForProject) => new CustomId(false, $dbForProject->getAdapter()->getMaxUIDLength()), 'Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.', false, ['dbForProject']) ->param('key', null, new Text(Database::LENGTH_KEY), 'Variable key. Max length: ' . Database::LENGTH_KEY . ' chars.') ->param('value', null, new Text(8192, 0), 'Variable value. Max length: 8192 chars.') ->param('secret', true, new Boolean(), 'Secret variables can be updated or deleted, but only projects can read them during build and runtime.', true) diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 0bb78e7cb8..e0f94b64cc 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -4771,22 +4771,6 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals('APP_TEST_CREATE_1', $variable['body']['key']); $this->assertEmpty($variable['body']['value']); - // test for variable without variableId (auto-generated) - $variable = $this->client->call(Client::METHOD_POST, '/project/variables', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $data['projectId'], - 'x-appwrite-mode' => 'admin', - ], $this->getHeaders()), [ - 'key' => 'APP_TEST_CREATE_AUTO_ID', - 'value' => 'AUTOIDVALUE', - 'secret' => false - ]); - - $this->assertEquals(201, $variable['headers']['status-code']); - $this->assertNotEmpty($variable['body']['$id']); - $this->assertEquals('APP_TEST_CREATE_AUTO_ID', $variable['body']['key']); - $this->assertEquals('AUTOIDVALUE', $variable['body']['value']); - /** * Test for FAILURE */