From 627930e33667dbe591ade8886a7c9b1616e18e57 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 17 Dec 2024 21:10:49 +0100 Subject: [PATCH 1/3] refactor(OpenApi): Remove unused route requirements Signed-off-by: provokateurin --- appinfo/routes/routesBotController.php | 8 ++++++-- appinfo/routes/routesRecordingController.php | 14 +++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/appinfo/routes/routesBotController.php b/appinfo/routes/routesBotController.php index 22c2931f438..c008f8e8261 100644 --- a/appinfo/routes/routesBotController.php +++ b/appinfo/routes/routesBotController.php @@ -8,6 +8,10 @@ $requirements = [ 'apiVersion' => '(v1)', +]; + +$requirementsWithToken = [ + 'apiVersion' => '(v1)', 'token' => '[a-z0-9]{4,30}', ]; @@ -26,7 +30,7 @@ return [ 'ocs' => [ /** @see \OCA\Talk\Controller\BotController::sendMessage() */ - ['name' => 'Bot#sendMessage', 'url' => '/api/{apiVersion}/bot/{token}/message', 'verb' => 'POST', 'requirements' => $requirements], + ['name' => 'Bot#sendMessage', 'url' => '/api/{apiVersion}/bot/{token}/message', 'verb' => 'POST', 'requirements' => $requirementsWithToken], /** @see \OCA\Talk\Controller\BotController::react() */ ['name' => 'Bot#react', 'url' => '/api/{apiVersion}/bot/{token}/reaction/{messageId}', 'verb' => 'POST', 'requirements' => $requirementsWithMessageId], /** @see \OCA\Talk\Controller\BotController::deleteReaction() */ @@ -34,7 +38,7 @@ /** @see \OCA\Talk\Controller\BotController::adminListBots() */ ['name' => 'Bot#adminListBots', 'url' => '/api/{apiVersion}/bot/admin', 'verb' => 'GET', 'requirements' => $requirements], /** @see \OCA\Talk\Controller\BotController::listBots() */ - ['name' => 'Bot#listBots', 'url' => '/api/{apiVersion}/bot/{token}', 'verb' => 'GET', 'requirements' => $requirements], + ['name' => 'Bot#listBots', 'url' => '/api/{apiVersion}/bot/{token}', 'verb' => 'GET', 'requirements' => $requirementsWithToken], /** @see \OCA\Talk\Controller\BotController::enableBot() */ ['name' => 'Bot#enableBot', 'url' => '/api/{apiVersion}/bot/{token}/{botId}', 'verb' => 'POST', 'requirements' => $requirementsWithBotId], /** @see \OCA\Talk\Controller\BotController::disableBot() */ diff --git a/appinfo/routes/routesRecordingController.php b/appinfo/routes/routesRecordingController.php index 9cb2f47d9c5..7826d663ecc 100644 --- a/appinfo/routes/routesRecordingController.php +++ b/appinfo/routes/routesRecordingController.php @@ -8,6 +8,10 @@ $requirements = [ 'apiVersion' => '(v1)', +]; + +$requirementsWithToken = [ + 'apiVersion' => '(v1)', 'token' => '[a-z0-9]{4,30}', ]; @@ -20,14 +24,14 @@ /** @see \OCA\Talk\Controller\RecordingController::backend() */ ['name' => 'Recording#backend', 'url' => '/api/{apiVersion}/recording/backend', 'verb' => 'POST', 'requirements' => $requirements], /** @see \OCA\Talk\Controller\RecordingController::start() */ - ['name' => 'Recording#start', 'url' => '/api/{apiVersion}/recording/{token}', 'verb' => 'POST', 'requirements' => $requirements], + ['name' => 'Recording#start', 'url' => '/api/{apiVersion}/recording/{token}', 'verb' => 'POST', 'requirements' => $requirementsWithToken], /** @see \OCA\Talk\Controller\RecordingController::stop() */ - ['name' => 'Recording#stop', 'url' => '/api/{apiVersion}/recording/{token}', 'verb' => 'DELETE', 'requirements' => $requirements], + ['name' => 'Recording#stop', 'url' => '/api/{apiVersion}/recording/{token}', 'verb' => 'DELETE', 'requirements' => $requirementsWithToken], /** @see \OCA\Talk\Controller\RecordingController::store() */ - ['name' => 'Recording#store', 'url' => '/api/{apiVersion}/recording/{token}/store', 'verb' => 'POST', 'requirements' => $requirements], + ['name' => 'Recording#store', 'url' => '/api/{apiVersion}/recording/{token}/store', 'verb' => 'POST', 'requirements' => $requirementsWithToken], /** @see \OCA\Talk\Controller\RecordingController::notificationDismiss() */ - ['name' => 'Recording#notificationDismiss', 'url' => '/api/{apiVersion}/recording/{token}/notification', 'verb' => 'DELETE', 'requirements' => $requirements], + ['name' => 'Recording#notificationDismiss', 'url' => '/api/{apiVersion}/recording/{token}/notification', 'verb' => 'DELETE', 'requirements' => $requirementsWithToken], /** @see \OCA\Talk\Controller\RecordingController::shareToChat() */ - ['name' => 'Recording#shareToChat', 'url' => '/api/{apiVersion}/recording/{token}/share-chat', 'verb' => 'POST', 'requirements' => $requirements], + ['name' => 'Recording#shareToChat', 'url' => '/api/{apiVersion}/recording/{token}/share-chat', 'verb' => 'POST', 'requirements' => $requirementsWithToken], ], ]; From 073096c570e63414aa587f80b794f775febe5324 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 17 Dec 2024 21:11:42 +0100 Subject: [PATCH 2/3] refactor(OpenApi): Remove unused schema Signed-off-by: provokateurin --- lib/Model/BotServer.php | 6 ++++-- lib/ResponseDefinitions.php | 4 ---- openapi-full.json | 18 ------------------ src/types/openapi/openapi-full.ts | 3 --- 4 files changed, 4 insertions(+), 27 deletions(-) diff --git a/lib/Model/BotServer.php b/lib/Model/BotServer.php index 1bebf557c93..35c0bd2153f 100644 --- a/lib/Model/BotServer.php +++ b/lib/Model/BotServer.php @@ -34,7 +34,7 @@ * @method void setFeatures(int $features) * @method int getFeatures() * - * @psalm-import-type TalkBotWithDetailsAndSecret from ResponseDefinitions + * @psalm-import-type TalkBotWithDetails from ResponseDefinitions */ class BotServer extends Entity implements \JsonSerializable { protected string $name = ''; @@ -62,7 +62,9 @@ public function __construct() { } /** - * @return TalkBotWithDetailsAndSecret + * @return TalkBotWithDetails&array{ + * secret: string, + * } */ public function jsonSerialize(): array { return [ diff --git a/lib/ResponseDefinitions.php b/lib/ResponseDefinitions.php index 60da06cf6cb..f3e04023de3 100644 --- a/lib/ResponseDefinitions.php +++ b/lib/ResponseDefinitions.php @@ -40,10 +40,6 @@ * url_hash: string, * } * - * @psalm-type TalkBotWithDetailsAndSecret = TalkBotWithDetails&array{ - * secret: string, - * } - * * @psalm-type TalkCallPeer = array{ * actorId: string, * actorType: string, diff --git a/openapi-full.json b/openapi-full.json index eccc60c132b..b609e45f551 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -189,24 +189,6 @@ } ] }, - "BotWithDetailsAndSecret": { - "allOf": [ - { - "$ref": "#/components/schemas/BotWithDetails" - }, - { - "type": "object", - "required": [ - "secret" - ], - "properties": { - "secret": { - "type": "string" - } - } - } - ] - }, "CallPeer": { "type": "object", "required": [ diff --git a/src/types/openapi/openapi-full.ts b/src/types/openapi/openapi-full.ts index eafe8a13943..f4e658a405c 100644 --- a/src/types/openapi/openapi-full.ts +++ b/src/types/openapi/openapi-full.ts @@ -1962,9 +1962,6 @@ export type components = { url: string; url_hash: string; }; - BotWithDetailsAndSecret: components["schemas"]["BotWithDetails"] & { - secret: string; - }; CallPeer: { actorId: string; actorType: string; From 14c0d235fe6bf4a9f94729822c398afab04ec5a2 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 17 Dec 2024 21:11:57 +0100 Subject: [PATCH 3/3] chore(deps): Update openapi-extractor to v1.3.0 Signed-off-by: provokateurin --- vendor-bin/openapi-extractor/composer.lock | 40 ++++++++++++---------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/vendor-bin/openapi-extractor/composer.lock b/vendor-bin/openapi-extractor/composer.lock index cf75aaf5078..37dedb6a1cc 100644 --- a/vendor-bin/openapi-extractor/composer.lock +++ b/vendor-bin/openapi-extractor/composer.lock @@ -9,16 +9,16 @@ "packages-dev": [ { "name": "adhocore/cli", - "version": "v1.8.0", + "version": "v1.9.3", "source": { "type": "git", "url": "https://github.com/adhocore/php-cli.git", - "reference": "6092763ab212038de64c44545574cedb7ef86269" + "reference": "86be16e3c3b42d76fcdb32529bcded0fedb925d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/adhocore/php-cli/zipball/6092763ab212038de64c44545574cedb7ef86269", - "reference": "6092763ab212038de64c44545574cedb7ef86269", + "url": "https://api.github.com/repos/adhocore/php-cli/zipball/86be16e3c3b42d76fcdb32529bcded0fedb925d3", + "reference": "86be16e3c3b42d76fcdb32529bcded0fedb925d3", "shasum": "" }, "require": { @@ -29,6 +29,9 @@ }, "type": "library", "autoload": { + "files": [ + "src/functions.php" + ], "psr-4": { "Ahc\\Cli\\": "src/" } @@ -63,7 +66,7 @@ ], "support": { "issues": "https://github.com/adhocore/php-cli/issues", - "source": "https://github.com/adhocore/php-cli/tree/v1.8.0" + "source": "https://github.com/adhocore/php-cli/tree/v1.9.3" }, "funding": [ { @@ -75,20 +78,20 @@ "type": "github" } ], - "time": "2024-11-15T08:55:32+00:00" + "time": "2024-12-04T03:40:29+00:00" }, { "name": "nextcloud/openapi-extractor", - "version": "v1.2.2", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/nextcloud-releases/openapi-extractor.git", - "reference": "fb177110c9d182dd9c6c5c19d20f1275f2b7f6af" + "reference": "c0761cb7a3a0cd29c85ede9f27883d7f9f477bd0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud-releases/openapi-extractor/zipball/fb177110c9d182dd9c6c5c19d20f1275f2b7f6af", - "reference": "fb177110c9d182dd9c6c5c19d20f1275f2b7f6af", + "url": "https://api.github.com/repos/nextcloud-releases/openapi-extractor/zipball/c0761cb7a3a0cd29c85ede9f27883d7f9f477bd0", + "reference": "c0761cb7a3a0cd29c85ede9f27883d7f9f477bd0", "shasum": "" }, "require": { @@ -100,11 +103,12 @@ }, "require-dev": { "nextcloud/coding-standard": "^1.2", - "nextcloud/ocp": "dev-master" + "nextcloud/ocp": "dev-master", + "rector/rector": "^2.0" }, "bin": [ - "generate-spec", - "merge-specs" + "bin/generate-spec", + "bin/merge-specs" ], "type": "library", "autoload": { @@ -119,9 +123,9 @@ "description": "A tool for extracting OpenAPI specifications from Nextcloud source code", "support": { "issues": "https://github.com/nextcloud-releases/openapi-extractor/issues", - "source": "https://github.com/nextcloud-releases/openapi-extractor/tree/v1.2.2" + "source": "https://github.com/nextcloud-releases/openapi-extractor/tree/v1.3.0" }, - "time": "2024-11-13T10:36:57+00:00" + "time": "2024-12-17T16:34:26+00:00" }, { "name": "nikic/php-parser", @@ -231,11 +235,11 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [], + "platform": {}, + "platform-dev": {}, "platform-overrides": { "php": "8.1" },