Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
"squizlabs/php_codesniffer": "3.*"
},
"platform": {
"php": "8.2"
"php": "8.3"
}
}
2 changes: 1 addition & 1 deletion example.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function configureSDK($sdk, $overrides = []) {
'gitRepoName' => 'reponame',
'twitter' => 'appwrite',
'discord' => ['564160730845151244', 'https://appwrite.io/discord'],
'defaultHeaders' => ['X-Appwrite-Response-Format' => '1.6.0'],
'defaultHeaders' => ['X-Appwrite-Response-Format' => '1.8.0'],
'readme' => '**README**',
];

Expand Down
37 changes: 36 additions & 1 deletion mock-server/app/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Utopia\MockServer\Utopia\Response;
use Utopia\Swoole\Request;
use Utopia\Swoole\Response as UtopiaSwooleResponse;
use Utopia\Validator\JSON;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

rg -n '\bJSON\b' mock-server/app/http.php

Repository: appwrite/sdk-generator

Length of output: 95


Remove unused import: Utopia\Validator\JSON.

The JSON validator is imported on line 21 but is not used anywhere in this file.

🤖 Prompt for AI Agents
In mock-server/app/http.php around line 21, the file imports
Utopia\Validator\JSON which is unused; remove the unused import line (delete the
"use Utopia\Validator\JSON;" statement) to clean up imports and avoid dead code
warnings, then run a quick linter or PHP syntax check to confirm no references
remain.

use Utopia\Validator\Text;
use Utopia\Validator\Integer;
use Utopia\Validator\ArrayList;
Expand All @@ -26,8 +27,9 @@
use Utopia\Validator\WhiteList;
use Swoole\Process;
use Swoole\Http\Server;
use Utopia\MockServer\Utopia\Model\Player;
use Utopia\MockServer\Utopia\Validator\Player as PlayerValidator;

// Appwrite Init Consts
const APP_AUTH_TYPE_SESSION = 'Session';
const APP_AUTH_TYPE_JWT = 'JWT';
const APP_AUTH_TYPE_KEY = 'Key';
Expand Down Expand Up @@ -521,6 +523,39 @@
->action(function (string $mockType) {
});

App::post('/v1/mock/tests/general/models')
->desc('Create Player')
->groups(['mock'])
->label('scope', 'public')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'general')
->label('sdk.method', 'createPlayer')
->label('sdk.description', 'Create a new player using a request model.')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->param('player', [], new PlayerValidator(), 'Player object.', model: Player::class)
->action(function (Player $player) {
});

App::post('/v1/mock/tests/general/models/array')
->desc('Create Players')
->groups(['mock'])
->label('scope', 'public')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'general')
->label('sdk.method', 'createPlayers')
->label('sdk.description', 'Create multiple players using an array of request models.')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MOCK)
->label('sdk.mock', true)
->param('players', [], new ArrayList(new PlayerValidator(), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of player objects.', model: Player::class)
->action(function (array $players) {
/** @var Player[] $players */
});

App::get('/v1/mock/tests/general/400-error')
->desc('400 Error')
->groups(['mock'])
Expand Down
8 changes: 7 additions & 1 deletion mock-server/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
"swoole/ide-helper": "5.1.2"
},
"platform": {
"php": "8.2"
"php": "8.4"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"tbachert/spi": true
}
}
Comment on lines 18 to 26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Find and examine the root composer.json
find . -maxdepth 2 -name "composer.json" -type f

Repository: appwrite/sdk-generator

Length of output: 109


🏁 Script executed:

# Check root composer.json for PHP version constraint
cat -n composer.json | grep -A 5 -B 5 "php"

Repository: appwrite/sdk-generator

Length of output: 1127


🏁 Script executed:

# Check mock-server composer.json dependencies
cat -n mock-server/composer.json

Repository: appwrite/sdk-generator

Length of output: 873


🏁 Script executed:

# Look for CI configuration files
find . -type f \( -name ".github" -o -name ".gitlab-ci.yml" -o -name ".travis.yml" -o -name "phpunit.xml" \) 2>/dev/null | head -20

Repository: appwrite/sdk-generator

Length of output: 79


🏁 Script executed:

# Search for workflow files in .github
find .github -type f -name "*.yml" -o -name "*.yaml" 2>/dev/null | head -20

Repository: appwrite/sdk-generator

Length of output: 275


🏁 Script executed:

cat -n .github/workflows/tests.yml

Repository: appwrite/sdk-generator

Length of output: 3426


🏁 Script executed:

# Search for references to the plugins in the codebase
rg "php-http/discovery|tbachert/spi" --type json

Repository: appwrite/sdk-generator

Length of output: 1052


Mock-server PHP 8.4 platform constraint: ensure CI/runtime alignment

The mock-server platform is set to PHP 8.4, which is stricter than the root constraint ("php": ">=8.3"). The allowed plugins (php-http/discovery and tbachert/spi) are available as transitive dependencies and won't cause Composer warnings.

However, the CI workflow currently runs tests with PHP 8.3 only (line 15 of .github/workflows/tests.yml), not 8.4. Confirm that your mock-server runtime environment actually uses PHP 8.4, or adjust the platform constraint if testing remains on 8.3.

}
Loading
Loading