openxtrem/oas-generator

4.0.0 2024-06-03 20:16 UTC

README

关于

将 Symfony 路由集合转换为 Open Api 规范。使用 cebe/php-openapi 进行 OAS 验证。


如何使用

$oas = new Specifications();
$oas->setVersion('1.0.0')
    ->setTitle('OX APIs documentation')
    ->setDescription('This documentation ...')
    ->setContact('admin', 'admin@info.fr')
    ->setLicense('GPL', 'https://openxtrem.com/licenses/gpl.html')
    ->addTag('system', 'This is a tag');
    ->addServer('http://lorem-ipsum.fr', 'description')
    ->addSecurity(
        'Token', 'apiKey', 'header token', [
                   'in'   => 'header',
                   'name' => 'X-OXAPI-KEY',
               ])
    ->addSchema(new Scheam('lorem', 'object'));

$routes = new RouteCollection(); // your routes

$generator     = new Generator($oas, $routes);
$documentation = $generator->generate();

如何测试?

 vendor/bin/phpunit -c phpunit.xml

需要帮助吗?

https://openapis.org.cn/