From 7db6e0c1e9786bc87c2b33efc65ba77ef8b746e2 Mon Sep 17 00:00:00 2001 From: Arman <407448+armanist@users.noreply.github.com> Date: Wed, 13 May 2026 20:51:46 +0400 Subject: [PATCH] [#520] Fix OpenAPI generated routes response contract --- CHANGELOG.md | 1 + src/Console/Commands/OpenApiCommand.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0912dd6d..9347a16b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,7 @@ - Fixed cURL error message assertions for cross-version compatibility - Fixed SleekDB paginator query-state regression where `count()` could clear criteria before paginated data fetch on the same model instance (#514) - Standardized `defineValidationRules(Request $request): void` across DemoWeb and DemoApi middleware templates +- Fixed OpenAPI installer route generation to return `Response` objects via `response()->...` helpers and avoid undefined response-variable usage (#520) - Standardized `defineValidationRules(Request $request): void` in Toolkit middleware templates ### Added diff --git a/src/Console/Commands/OpenApiCommand.php b/src/Console/Commands/OpenApiCommand.php index a8250489..c5183ac8 100644 --- a/src/Console/Commands/OpenApiCommand.php +++ b/src/Console/Commands/OpenApiCommand.php @@ -192,13 +192,13 @@ private function openapiRoutes(string $module): string { return 'return function ($route) { $route->group("openapi", function ($route) { - $route->get("docs", function (Quantum\Http\Response $response) { - $response->html(partial("openApi/openApi")); + $route->get("docs", function (): Quantum\Http\Response { + return response()->html(partial("openApi/openApi")); }); - $route->get("spec", function (Quantum\Http\Response $response) { + $route->get("spec", function (): Quantum\Http\Response { $fs = Quantum\Storage\Factories\FileSystemFactory::get(); - $response->json($fs->getJson(modules_dir() . "' . DS . $module . DS . 'resources' . DS . 'openapi' . DS . 'spec.json")); + return response()->json($fs->getJson(modules_dir() . "' . DS . $module . DS . 'resources' . DS . 'openapi' . DS . 'spec.json")); }); });' . PHP_EOL; }