-
Notifications
You must be signed in to change notification settings - Fork 938
/
scan.php
29 lines (23 loc) · 884 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
<?php
use OpenApi\Generator;
use OpenApi\Pipeline;
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__);
$insertMatch = function (array $pipes) {
foreach ($pipes as $ii => $pipe) {
if ($pipe instanceof BuildPaths) {
return $ii;
}
}
return null;
};
$openapi = (new Generator())
->withProcessor(function (Pipeline $pipeline) use ($insertMatch) { $pipeline->insert(new SchemaQueryParameter(), $insertMatch); })
->generate([__DIR__ . '/app']);
// file_put_contents(__DIR__ . '/schema-query-parameter.yaml', $openapi->toYaml());
echo $openapi->toYaml();