Repository navigation
fix: make variableId optional in createProjectVariable endpoint - #11795
Conversation
Greptile SummaryThis PR fixes a bug where the Console UI's "Create Global Variable" flow always failed because the Confidence Score: 5/5Safe to merge — minimal, correct fix with a dedicated new test case. The change is a one-line param-signature update; the ID-generation logic was already handled correctly. A new E2E test case explicitly covers the omitted-ID path. No P0/P1 findings. No files require special attention.
|
| Filename | Overview |
|---|---|
| src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Create.php | Makes variableId optional (default 'unique()') to match Console UI behavior; action already handled the unique() substitution on line 75, so this is a minimal, correct fix. |
| tests/e2e/Services/Projects/ProjectsConsoleClientTest.php | Adds a test case that omits variableId and asserts a 201 with an auto-generated $id; also adds x-appwrite-response-format: 1.8.0 headers and updates platform type assertions from merge-in 1.9.x changes. |
Reviews (5): Last reviewed commit: "Merge branch '1.9.x' into fix-11765-glob..." | Re-trigger Greptile
ChiragAgg5k
left a comment
There was a problem hiding this comment.
- lets remove any formatting changes unrelated to the fix
- add a test case where we dont pass in variableId and verify it suceeds

What does this PR do?
Fixes a bug where creating a global variable (Settings > Global variables) always fails with "Param 'variableId' is not optional".
The
createProjectVariableendpoint definedvariableIdas a required param, but the Console UI does not send it. Other similar endpoints (createVariablefor Functions and Sites) generate the ID internally usingID::unique().This fix makes
variableIdoptional with a default of'unique()', which the action already handles on line 76. This matches the behavior of the Functions and Sites variable endpoints.Test Plan
Related PRs and Issues
Fixes #11765
Checklist