From 7ce44253cf8a70604aea1bb986434a329f673fdc Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko Date: Wed, 12 Feb 2025 15:21:10 +0200 Subject: [PATCH] fixed parameters extractors for different api versions --- src/Configuration/ParametersExtractors.php | 8 ++++++++ src/ScrambleServiceProvider.php | 10 +--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Configuration/ParametersExtractors.php b/src/Configuration/ParametersExtractors.php index b63ffec7..61a0f55d 100644 --- a/src/Configuration/ParametersExtractors.php +++ b/src/Configuration/ParametersExtractors.php @@ -2,7 +2,9 @@ namespace Dedoc\Scramble\Configuration; +use Dedoc\Scramble\Support\OperationExtensions\ParameterExtractor\AttributesParametersExtractor; use Dedoc\Scramble\Support\OperationExtensions\ParameterExtractor\FormRequestParametersExtractor; +use Dedoc\Scramble\Support\OperationExtensions\ParameterExtractor\MethodCallsParametersExtractor; use Dedoc\Scramble\Support\OperationExtensions\ParameterExtractor\PathParametersExtractor; use Dedoc\Scramble\Support\OperationExtensions\ParameterExtractor\ValidateCallParametersExtractor; use Illuminate\Support\Arr; @@ -50,10 +52,16 @@ public function all(): array ValidateCallParametersExtractor::class, ]; + $defaultAppends = [ + MethodCallsParametersExtractor::class, + AttributesParametersExtractor::class, + ]; + return array_values(array_unique([ ...$this->prepends, ...$base, ...$this->appends, + ...$defaultAppends, ])); } } diff --git a/src/ScrambleServiceProvider.php b/src/ScrambleServiceProvider.php index 5929907e..0f4ce8fc 100644 --- a/src/ScrambleServiceProvider.php +++ b/src/ScrambleServiceProvider.php @@ -206,15 +206,7 @@ public function bootingPackage() Scramble::configure()->expose(false); } - $this->app->booted(function (Application $app) { - Scramble::configure() - ->withParametersExtractors(function (ParametersExtractors $parametersExtractors) { - $parametersExtractors->append([ - MethodCallsParametersExtractor::class, - AttributesParametersExtractor::class, - ]); - }); - + $this->app->booted(function () { $this->registerRoutes(); }); }