Skip to content

Commit

Permalink
Change processors parsing (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkaOnLine authored May 12, 2021
1 parent 238e5d3 commit 4d5c4f1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
9 changes: 3 additions & 6 deletions config/l5-swagger.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,9 @@
* @link https://github.com/zircote/swagger-php/tree/master/Examples/schema-query-parameter-processor
* @see \OpenApi\scan
*/
'processors' => array_merge(
\OpenApi\Analysis::processors(),
[
// new \App\SwaggerProcessors\SchemaQueryParameter(),
]
),
'processors' => [
// new \App\SwaggerProcessors\SchemaQueryParameter(),
],

/**
* pattern: string $pattern File pattern(s) to scan (default: *.php) .
Expand Down
12 changes: 11 additions & 1 deletion src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,17 @@ protected function getScanOptions(): array
{
$options = [];

$processors = Arr::get($this->scanOptions, self::SCAN_OPTION_PROCESSORS, []);
$processorClasses = Arr::get($this->scanOptions, self::SCAN_OPTION_PROCESSORS, []);
$processors = [];

foreach (\OpenApi\Analysis::processors() as $processor) {
$processors[] = $processor;
if ($processor instanceof \OpenApi\Processors\BuildPaths) {
foreach ($processorClasses as $customProcessor) {
$processors[] = new $customProcessor();
}
}
}

if (! empty($processors)) {
$options[self::SCAN_OPTION_PROCESSORS] = $processors;
Expand Down

0 comments on commit 4d5c4f1

Please sign in to comment.