Skip to content

Commit

Permalink
Add 'Processor Configuration' section to processor reference
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann committed Jul 2, 2024
1 parent 029917a commit 7994365
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
28 changes: 28 additions & 0 deletions docs/reference/processors.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,34 @@ For improvements head over to [GitHub](https://github.com/zircote/swagger-php) a

*Processors are listed in the default order of execution.*

## Processor Configuration
### Command line
The `-c` option allows to specify a name/value pair with the name consisting
of the processor name (starting lowercase) and option name separated by a dot (`.`).

```shell
> ./bin/openapi -c operatinId.hash=true // ...
> ./bin/openapi -c pathFilter.tags[]=/pets/ -c pathFilter.tags[]=/store/ // ...
```

### Programmatically with PHP
Configuration can be set using the `Generator::setConfig()` method. Keys can either be the same
as on the command line or be broken down into nested arrays.

```php
(new Generator())
->setConfig([
'operationId.hash' => true,
'pathFilter' => [
'tags' => [
'/pets/',
'/store/',
],
],
]);
```


## Default Processors
### [DocBlockDescriptions](https://github.com/zircote/swagger-php/tree/master/src/Processors/DocBlockDescriptions.php)

Expand Down
38 changes: 37 additions & 1 deletion tools/procgen.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,44 @@
ob_start();

echo $procgen->preamble('Processors');
echo PHP_EOL . '## Default Processors' . PHP_EOL;

echo PHP_EOL . '## Processor Configuration' . PHP_EOL;

echo '### Command line' . PHP_EOL;
echo <<< EOT
The `-c` option allows to specify a name/value pair with the name consisting
of the processor name (starting lowercase) and option name separated by a dot (`.`).
```shell
> ./bin/openapi -c operatinId.hash=true // ...
> ./bin/openapi -c pathFilter.tags[]=/pets/ -c pathFilter.tags[]=/store/ // ...
```
EOT;

echo '### Programmatically with PHP' . PHP_EOL;
echo <<< EOT
Configuration can be set using the `Generator::setConfig()` method. Keys can either be the same
as on the command line or be broken down into nested arrays.
```php
(new Generator())
->setConfig([
'operationId.hash' => true,
'pathFilter' => [
'tags' => [
'/pets/',
'/store/',
],
],
]);
```
EOT;

echo PHP_EOL . '## Default Processors' . PHP_EOL;
foreach ($procgen->getProcessorsDetails() as $ii => $details) {
$off = $ii + 1;
echo $procgen->formatClassHeader($details['name'], 'Processors');
Expand Down

0 comments on commit 7994365

Please sign in to comment.