folksyfolks/l5-swagger

Laravel 的 OpenApi 或 Swagger 集成

支持包维护!
DarkaOnLine

8.6.1 2024-04-19 17:38 UTC

README

这是一个从 DarkaOnLine 的 L5-swagger 分支出来的版本。版本锁定为 8.1.0。

有关如何使用此包的更多信息,请参阅原始分支的文档。

变更

此包的主要变化是能够从 "scanOptions" 配置键定义,我们想在哪个处理器后添加我们的自定义处理器。

使用方法

有关基本用法,请参阅 原始文档

至于自定义用法,我们在 scanOptions 下简单地添加了一个配置键 append-processors-after

// l5-swagger.php
return [
    'default' => 'default',
    'documentations' => [
       /* ... */
    ],
    'defaults' => [ 
        /* ... */
        'scanOptions' => [
            /* ... */
            'processors' => [
                // new \App\SwaggerProcessors\SchemaQueryParameter(),
            ],

            /**
             * Define after which Open Api's processors we want to happens the custom one.
             */
            'append-processors-after' => \OpenApi\Processors\BuildPaths::class,

            /* ... */
        ],
    /* ... */
];

默认值为 \OpenApi\Processors\BuildPaths::class,这是原始分支中的原始值。