From 33591e2fa70c52e3ca95a4844f172e29375fd2e5 Mon Sep 17 00:00:00 2001 From: HafizMMoaz Date: Fri, 17 Jul 2026 20:44:01 +0500 Subject: [PATCH] Register scoped API docs at /docs/lead via Scramble --- src/Providers/LeadServiceProvider.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Providers/LeadServiceProvider.php b/src/Providers/LeadServiceProvider.php index 73722aa..3d791a0 100644 --- a/src/Providers/LeadServiceProvider.php +++ b/src/Providers/LeadServiceProvider.php @@ -16,7 +16,17 @@ public function boot(): void if (file_exists($apiRoutesPath)) { $this->loadRoutesFrom($apiRoutesPath); } - + + // Scoped Swagger/OpenAPI docs for this module at /docs/lead. + // Guarded so the package still works if the host app has no Scramble. + if (class_exists(\Dedoc\Scramble\Scramble::class)) { + \Dedoc\Scramble\Scramble::registerApi('lead', [ + 'api_path' => 'api/lead', + 'info' => ['version' => \Composer\InstalledVersions::getPrettyVersion('zerp/lead') ?? '1.0.0', 'description' => 'Zerp Lead/CRM module REST API for mobile and third-party clients.'], + 'ui' => ['title' => 'Zerp Lead API'], + ])->expose(ui: '/docs/lead', document: '/docs/lead.json'); + } + $migrationsPath = __DIR__.'/../Database/Migrations'; if (is_dir($migrationsPath)) { $this->loadMigrationsFrom($migrationsPath);