Generate SDKs and specs from OpenAPI 3 only (#12565)

Update appwrite/sdk-generator to ^2.0, where OpenAPI 3 is the native
spec parsing pipeline, and remove Swagger 2 spec generation entirely:

- The sdks task generates from open-api3-* spec files via the
  generator's OpenAPI3 parser
- The specs task only emits the open-api3 format
- The Swagger2 specification format class is removed; keeping two
  format emitters in sync was pure maintenance overhead now that
  nothing consumes the swagger2 output

SDK examples regenerated through the new pipeline are byte-identical
to the committed ones.
This commit is contained in:
Chirag Aggarwal authored and GitHub committed 2026-06-11 12:41:53 +05:30
1 parent 5453271705
commit ab0d9b2ba8
6 files changed
+19 -1108

No files matched your search

+1 -1
View File
@@ -108,7 +108,7 @@
],
"require-dev": {
"ext-fileinfo": "*",
"appwrite/sdk-generator": "*",
"appwrite/sdk-generator": "^2.0",
"brianium/paratest": "7.*",
"phpunit/phpunit": "12.*",
"swoole/ide-helper": "6.*",
Generated
+12 -11
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1cc46b6b8e657c29ee41fd975a2033f8",
"content-hash": "9f9908fb48b239cd403e78fb9e1cdbb8",
"packages": [
{
"name": "adhocore/jwt",
@@ -5398,16 +5398,16 @@
"packages-dev": [
{
"name": "appwrite/sdk-generator",
"version": "1.32.0",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "7ec48fd30746e9fbc3a9bd7d3af8052acf400ff8"
"reference": "60a2e804c1464494d763e5ff6bfff9b188502253"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/7ec48fd30746e9fbc3a9bd7d3af8052acf400ff8",
"reference": "7ec48fd30746e9fbc3a9bd7d3af8052acf400ff8",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/60a2e804c1464494d763e5ff6bfff9b188502253",
"reference": "60a2e804c1464494d763e5ff6bfff9b188502253",
"shasum": ""
},
"require": {
@@ -5415,19 +5415,20 @@
"ext-json": "*",
"ext-mbstring": "*",
"matthiasmullie/minify": "1.3.*",
"php": ">=8.3",
"php": ">=8.5",
"twig/twig": "3.27.*"
},
"require-dev": {
"brianium/paratest": "7.*",
"phpunit/phpunit": "11.*",
"rector/rector": "^2.4",
"squizlabs/php_codesniffer": "3.*"
},
"type": "library",
"autoload": {
"psr-4": {
"Appwrite\\SDK\\": "src/SDK",
"Appwrite\\Spec\\": "src/Spec"
"Appwrite\\SDK\\": "src/SDK/",
"Appwrite\\Spec\\": "src/Spec/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -5440,12 +5441,12 @@
"email": "eldad@appwrite.io"
}
],
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"description": "SDK generator for Appwrite APIs across multiple programming languages and platforms",
"support": {
"issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/1.32.0"
"source": "https://github.com/appwrite/sdk-generator/tree/2.0.0"
},
"time": "2026-06-03T08:49:57+00:00"
"time": "2026-06-11T05:54:24+00:00"
},
{
"name": "brianium/paratest",
+4 -4
View File
@@ -27,8 +27,8 @@ use Appwrite\SDK\Language\Swift;
use Appwrite\SDK\Language\Unity;
use Appwrite\SDK\Language\Web;
use Appwrite\SDK\SDK;
use Appwrite\Spec\OpenAPI3;
use Appwrite\Spec\StaticSpec;
use Appwrite\Spec\Swagger2;
use CzProject\GitPhp\Git;
use Utopia\Agents\Adapters\OpenAI;
use Utopia\Agents\DiffCheck\DiffCheck;
@@ -302,14 +302,14 @@ class SDKs extends Action
}
Console::info("━━━ {$language['name']} SDK ({$platform['name']}, {$version}) ━━━");
$specFormat = $language['spec'] ?? 'swagger2';
$specFormat = $language['spec'] ?? 'openapi3';
$spec = null;
if ($specFormat === 'static') {
Console::log(' Using static SDK spec...');
} else {
Console::log(' Fetching API spec...');
$specPath = __DIR__ . '/../../../../app/config/specs/swagger2-' . $version . '-' . $language['family'] . '.json';
$specPath = __DIR__ . '/../../../../app/config/specs/open-api3-' . $version . '-' . $language['family'] . '.json';
if (!file_exists($specPath)) {
throw new \Exception('Spec file not found: ' . $specPath . '. Please run "docker compose exec appwrite specs --version=' . $version . '" first to generate the specs.');
@@ -483,7 +483,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
licenseName: 'BSD-3-Clause',
licenseURL: 'https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE',
)
: new Swagger2($spec)
: new OpenAPI3($spec)
);
$sdk
+1 -3
View File
@@ -6,7 +6,6 @@ use Appwrite\Network\Validator\Redirect;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Specification\Format\OpenAPI3;
use Appwrite\SDK\Specification\Format\Swagger2;
use Appwrite\SDK\Specification\Specification;
use Appwrite\Utopia\Request as AppwriteRequest;
use Appwrite\Utopia\Response as AppwriteResponse;
@@ -62,7 +61,6 @@ class Specs extends Action
protected function getFormatInstance(string $format, array $arguments)
{
return match ($format) {
'swagger2' => new Swagger2(...$arguments),
'open-api3' => new OpenAPI3(...$arguments),
default => throw new Exception('Format not found: ' . $format)
};
@@ -660,7 +658,7 @@ class Specs extends Action
$platform
];
foreach (['swagger2', 'open-api3'] as $format) {
foreach (['open-api3'] as $format) {
$formatInstance = $this->getFormatInstance($format, $arguments);
$specs = new Specification($formatInstance);
File diff suppressed because it is too large. Load diff
+1 -39
View File
@@ -7,7 +7,6 @@ use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\SDK\Specification\Format;
use Appwrite\SDK\Specification\Format\OpenAPI3;
use Appwrite\SDK\Specification\Format\Swagger2;
use Appwrite\SDK\Specification\Validator\PasswordFormat;
use Appwrite\Utopia\Database\Validator\CustomId;
use Appwrite\Utopia\Response;
@@ -155,7 +154,6 @@ final class FormatTest extends TestCase
->param('transactionId', null, new Nullable(new Text(256)), 'Transaction ID.', true);
$openApi = (new OpenAPI3(new Container(), [], [$route], [], [], 0, 'console'))->parse();
$swagger = (new Swagger2(new Container(), [], [$route], [], [], 0, 'console'))->parse();
$this->assertArrayNotHasKey('requestBody', $openApi['paths']['/tests/{testId}']['delete']);
$this->assertCount(2, $openApi['paths']['/tests/{testId}']['delete']['parameters']);
@@ -163,10 +161,6 @@ final class FormatTest extends TestCase
$this->assertSame('transactionId', $openApi['paths']['/tests/{testId}']['delete']['parameters'][1]['name']);
$this->assertSame('query', $openApi['paths']['/tests/{testId}']['delete']['parameters'][1]['in']);
$this->assertCount(2, $swagger['paths']['/tests/{testId}']['delete']['parameters']);
$this->assertSame('path', $swagger['paths']['/tests/{testId}']['delete']['parameters'][0]['in']);
$this->assertSame('transactionId', $swagger['paths']['/tests/{testId}']['delete']['parameters'][1]['name']);
$this->assertSame('query', $swagger['paths']['/tests/{testId}']['delete']['parameters'][1]['in']);
}
public function testModelReferencesDoNotEmitItemsOnObjectProperties(): void
@@ -197,20 +191,14 @@ final class FormatTest extends TestCase
];
$openApi = (new OpenAPI3(new Container(), [], [$route], $models, [], 0, 'console'))->parse();
$swagger = (new Swagger2(new Container(), [], [$route], $models, [], 0, 'console'))->parse();
$openApiPrefs = $openApi['components']['schemas']['team']['properties']['prefs'];
$swaggerPrefs = $swagger['definitions']['team']['properties']['prefs'];
$this->assertArrayNotHasKey('items', $openApiPrefs);
$this->assertArrayNotHasKey('error', $openApi['components']['schemas']);
$this->assertSame('object', $openApiPrefs['type']);
$this->assertSame([['$ref' => '#/components/schemas/preferences']], $openApiPrefs['allOf']);
$this->assertArrayNotHasKey('items', $swaggerPrefs);
$this->assertArrayNotHasKey('error', $swagger['definitions']);
$this->assertSame('object', $swaggerPrefs['type']);
$this->assertSame([['$ref' => '#/definitions/preferences']], $swaggerPrefs['allOf']);
}
public function testArrayItemsSchemaInfersTypesFromJsonStringExamples(): void
@@ -278,10 +266,8 @@ final class FormatTest extends TestCase
];
$openApi = (new OpenAPI3(new Container(), [], [$route], $models, [], 0, 'console'))->parse();
$swagger = (new Swagger2(new Container(), [], [$route], $models, [], 0, 'console'))->parse();
$openApiHashOptions = $openApi['components']['schemas']['user']['properties']['hashOptions'];
$swaggerHashOptions = $swagger['definitions']['user']['properties']['hashOptions'];
$this->assertSame('object', $openApiHashOptions['type']);
$this->assertArrayNotHasKey('items', $openApiHashOptions);
@@ -290,10 +276,6 @@ final class FormatTest extends TestCase
$this->assertCount(7, $openApiHashOptions['allOf'][0]['oneOf']);
$this->assertSame(['$ref' => '#/components/schemas/algoArgon2'], $openApiHashOptions['allOf'][0]['oneOf'][0]);
$this->assertSame('object', $swaggerHashOptions['type']);
$this->assertArrayNotHasKey('items', $swaggerHashOptions);
$this->assertCount(7, $swaggerHashOptions['x-oneOf']);
$this->assertSame(['$ref' => '#/definitions/algoArgon2'], $swaggerHashOptions['x-oneOf'][0]);
}
public function testArraySchemasEmitItems(): void
@@ -330,14 +312,11 @@ final class FormatTest extends TestCase
));
$openApi = (new OpenAPI3(new Container(), [], [$requestRoute, $modelRoute], [new AttributeLine()], [], 0, 'console'))->parse();
$swagger = (new Swagger2(new Container(), [], [$requestRoute, $modelRoute], [new AttributeLine()], [], 0, 'console'))->parse();
$openApiRequestDefault = $openApi['paths']['/tests/spatial']['post']['requestBody']['content']['application/json']['schema']['properties']['default'];
$swaggerRequestDefault = $swagger['paths']['/tests/spatial']['post']['parameters'][0]['schema']['properties']['default'];
$openApiModelDefault = $openApi['components']['schemas']['attributeLine']['properties']['default'];
$swaggerModelDefault = $swagger['definitions']['attributeLine']['properties']['default'];
foreach ([$openApiRequestDefault, $swaggerRequestDefault, $openApiModelDefault, $swaggerModelDefault] as $default) {
foreach ([$openApiRequestDefault, $openApiModelDefault] as $default) {
$this->assertSame('array', $default['type']);
$this->assertSame('array', $default['items']['type']);
$this->assertSame('number', $default['items']['items']['type']);
@@ -370,10 +349,8 @@ final class FormatTest extends TestCase
->param('name', '', new Text(256), 'Name.');
$openApi = (new OpenAPI3(new Container(), [], [$route], [new Webhook()], [], 0, 'console'))->parse();
$swagger = (new Swagger2(new Container(), [], [$route], [new Webhook()], [], 0, 'console'))->parse();
$openApiProperties = $openApi['paths']['/tests']['post']['requestBody']['content']['application/json']['schema']['properties'];
$swaggerProperties = $swagger['paths']['/tests']['post']['parameters'][0]['schema']['properties'];
$this->assertSame('password', $openApiProperties['password']['format']);
$this->assertSame('password', $openApiProperties['nullablePassword']['format']);
@@ -381,11 +358,6 @@ final class FormatTest extends TestCase
$this->assertArrayNotHasKey('format', $openApiProperties['name']);
$this->assertSame('password', $openApi['components']['schemas']['webhook']['properties']['authPassword']['format']);
$this->assertSame('password', $swaggerProperties['password']['format']);
$this->assertSame('password', $swaggerProperties['nullablePassword']['format']);
$this->assertTrue($swaggerProperties['nullablePassword']['x-nullable']);
$this->assertArrayNotHasKey('format', $swaggerProperties['name']);
$this->assertSame('password', $swagger['definitions']['webhook']['properties']['authPassword']['format']);
}
public function testNoContentMethodsKeepProducesMetadata(): void
@@ -412,13 +384,11 @@ final class FormatTest extends TestCase
->param('testId', '', new Text(256), 'Test ID.');
$openApi = (new OpenAPI3(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse();
$swagger = (new Swagger2(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse();
$openApiMethod = $openApi['paths']['/tests/{testId}']['delete'];
$this->assertArrayNotHasKey('content', $openApiMethod['responses']['204']);
$this->assertSame(['application/json'], $openApiMethod['x-appwrite']['produces']);
$this->assertSame(['application/json'], $swagger['paths']['/tests/{testId}']['delete']['produces']);
}
public function testBinaryResponsesEmitResponseContent(): void
@@ -444,7 +414,6 @@ final class FormatTest extends TestCase
));
$openApi = (new OpenAPI3(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse();
$swagger = (new Swagger2(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse();
$openApiMethod = $openApi['paths']['/tests/icon']['get'];
@@ -453,7 +422,6 @@ final class FormatTest extends TestCase
$openApiMethod['responses']['200']['content']['image/png']['schema']
);
$this->assertArrayNotHasKey('produces', $openApiMethod['x-appwrite']);
$this->assertSame(['image/png'], $swagger['paths']['/tests/icon']['get']['produces']);
}
public function testAdditionalParametersAreIncludedInRequestBody(): void
@@ -481,13 +449,10 @@ final class FormatTest extends TestCase
));
$openApi = (new OpenAPI3(new Container(), [], [$route], [], [], 0, 'console'))->parse();
$swagger = (new Swagger2(new Container(), [], [$route], [], [], 0, 'console'))->parse();
$openApiQuery = $openApi['paths']['/tests/graphql']['post']['requestBody']['content']['application/json']['schema']['properties']['query'];
$swaggerQuery = $swagger['paths']['/tests/graphql']['post']['parameters'][0]['schema']['properties']['query'];
$this->assertSame('object', $openApiQuery['type']);
$this->assertEquals($swaggerQuery, $openApiQuery);
}
public function testJsonModelRulesKeepAdditionalPropertiesAndSkipNullable(): void
@@ -517,13 +482,10 @@ final class FormatTest extends TestCase
];
$openApi = (new OpenAPI3(new Container(), [], [$route], $models, [], 0, 'console'))->parse();
$swagger = (new Swagger2(new Container(), [], [$route], $models, [], 0, 'console'))->parse();
$openApiOptions = $openApi['components']['schemas']['provider']['properties']['options'];
$swaggerOptions = $swagger['definitions']['provider']['properties']['options'];
$this->assertTrue($openApiOptions['additionalProperties']);
$this->assertArrayNotHasKey('nullable', $openApiOptions);
$this->assertEquals($swaggerOptions, $openApiOptions);
}
}