mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
feat(response): restore project devKeys for response formats before 2.3.0
Add the V28 response filter, which returns an empty devKeys list on projects for older response formats, and fill devKeys in the generated SDK hydration test since the published PHP SDK still requires it.
This commit is contained in:
1 parent
15ec0ac0ce
commit
2179f904fe
3 files changed
+31
No files matched your search
@@ -51,6 +51,7 @@ use Appwrite\Utopia\Response\Filters\V24 as ResponseV24;
|
||||
use Appwrite\Utopia\Response\Filters\V25 as ResponseV25;
|
||||
use Appwrite\Utopia\Response\Filters\V26 as ResponseV26;
|
||||
use Appwrite\Utopia\Response\Filters\V27 as ResponseV27;
|
||||
use Appwrite\Utopia\Response\Filters\V28 as ResponseV28;
|
||||
use Appwrite\Utopia\View;
|
||||
use Executor\Exception\Timeout as ExecutorTimeout;
|
||||
use Executor\Executor;
|
||||
@@ -992,6 +993,9 @@ Http::init()
|
||||
*/
|
||||
$responseFormat = $request->getHeaderLine('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', ''));
|
||||
if ($responseFormat) {
|
||||
if (version_compare($responseFormat, '2.3.0', '<')) {
|
||||
$response->addFilter(new ResponseV28());
|
||||
}
|
||||
if (version_compare($responseFormat, '2.0.0', '<')) {
|
||||
$response->addFilter(new ResponseV27());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Appwrite\Utopia\Response\Filters;
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Filter;
|
||||
|
||||
// Convert 2.3.0 Data format to 2.2.0 format
|
||||
class V28 extends Filter
|
||||
{
|
||||
public function parse(array $content, string $model): array
|
||||
{
|
||||
return match ($model) {
|
||||
Response::MODEL_PROJECT => $this->parseProject($content),
|
||||
Response::MODEL_PROJECT_LIST => $this->handleList($content, 'projects', fn ($item) => $this->parseProject($item)),
|
||||
default => $content,
|
||||
};
|
||||
}
|
||||
|
||||
protected function parseProject(array $content): array
|
||||
{
|
||||
$content['devKeys'] = [];
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
@@ -128,6 +128,7 @@ final class ResponseTest extends TestCase
|
||||
]), Response::MODEL_PROJECT);
|
||||
|
||||
$project['wafEnabled'] = false;
|
||||
$project['devKeys'] = [];
|
||||
|
||||
$provider = $this->response->output(new Document([
|
||||
'credentials' => [],
|
||||
|
||||
Reference in new issue
Block a user