forked from zircote/swagger-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scan.php
33 lines (26 loc) · 888 Bytes
/
scan.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
use OpenApi\Generator;
use OpenApi\Processors\BuildPaths;
use SchemaQueryParameterProcessor\SchemaQueryParameter;
$classLoader = require __DIR__ . '/../../../vendor/autoload.php';
// register our app namespace...
$classLoader->addPsr4('App\\', __DIR__ . '/app');
// and our custom processor
$classLoader->addPsr4('SchemaQueryParameterProcessor\\', __DIR__);
$generator = new Generator();
// merge our custom processor
$processors = [];
foreach ($generator->getProcessors() as $processor) {
$processors[] = $processor;
if ($processor instanceof BuildPaths) {
$processors[] = new SchemaQueryParameter();
}
}
$options = [
'processors' => $processors,
];
$openapi = $generator
->setProcessors($processors)
->generate([__DIR__ . '/app']);
// file_put_contents(__DIR__ . '/schema-query-parameter.yaml', $openapi->toYaml());
echo $openapi->toYaml();