From 03469aeacf5a2f245cef66298bc3bcda174a0b16 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko Date: Wed, 15 May 2024 16:19:17 +0300 Subject: [PATCH 1/2] fix routes register booting --- src/ScrambleServiceProvider.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ScrambleServiceProvider.php b/src/ScrambleServiceProvider.php index 61c70d7d..8b319f2e 100644 --- a/src/ScrambleServiceProvider.php +++ b/src/ScrambleServiceProvider.php @@ -10,6 +10,7 @@ use Dedoc\Scramble\Infer\Extensions\InferExtension; use Dedoc\Scramble\Infer\Scope\Index; use Dedoc\Scramble\Infer\Services\FileParser; +use Dedoc\Scramble\Support\DefaultCallback; use Dedoc\Scramble\Support\ExceptionToResponseExtensions\AuthorizationExceptionToResponseExtension; use Dedoc\Scramble\Support\ExceptionToResponseExtensions\HttpExceptionToResponseExtension; use Dedoc\Scramble\Support\ExceptionToResponseExtensions\NotFoundExceptionToResponseExtension; @@ -39,6 +40,7 @@ use Dedoc\Scramble\Support\TypeToSchemaExtensions\LengthAwarePaginatorTypeToSchema; use Dedoc\Scramble\Support\TypeToSchemaExtensions\ModelToSchema; use Dedoc\Scramble\Support\TypeToSchemaExtensions\ResponseTypeToSchema; +use Illuminate\Support\Facades\Event; use PhpParser\ParserFactory; use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; @@ -160,5 +162,11 @@ public function bootingPackage() Scramble::registerApi('default', config('scramble')) ->routes(Scramble::$routeResolver) ->afterOpenApiGenerated(Scramble::$openApiExtender); + + $this->app->booted(function () { + Scramble::getGeneratorConfig('default') + ->routes(Scramble::$routeResolver) + ->afterOpenApiGenerated(Scramble::$openApiExtender); + }); } } From f0b2ac615fce05afaef60880678060ac2a977b54 Mon Sep 17 00:00:00 2001 From: romalytvynenko Date: Wed, 15 May 2024 13:19:49 +0000 Subject: [PATCH 2/2] Fix styling --- src/ScrambleServiceProvider.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ScrambleServiceProvider.php b/src/ScrambleServiceProvider.php index 8b319f2e..e99fb81a 100644 --- a/src/ScrambleServiceProvider.php +++ b/src/ScrambleServiceProvider.php @@ -10,7 +10,6 @@ use Dedoc\Scramble\Infer\Extensions\InferExtension; use Dedoc\Scramble\Infer\Scope\Index; use Dedoc\Scramble\Infer\Services\FileParser; -use Dedoc\Scramble\Support\DefaultCallback; use Dedoc\Scramble\Support\ExceptionToResponseExtensions\AuthorizationExceptionToResponseExtension; use Dedoc\Scramble\Support\ExceptionToResponseExtensions\HttpExceptionToResponseExtension; use Dedoc\Scramble\Support\ExceptionToResponseExtensions\NotFoundExceptionToResponseExtension; @@ -40,7 +39,6 @@ use Dedoc\Scramble\Support\TypeToSchemaExtensions\LengthAwarePaginatorTypeToSchema; use Dedoc\Scramble\Support\TypeToSchemaExtensions\ModelToSchema; use Dedoc\Scramble\Support\TypeToSchemaExtensions\ResponseTypeToSchema; -use Illuminate\Support\Facades\Event; use PhpParser\ParserFactory; use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider;