Added swagger.scan.paths to rewrite scan paths for swagger. (#5402)

This commit is contained in:
李铭昕 2023-02-13 20:57:25 +08:00 committed by GitHub
parent 7fb1f43c19
commit 3262796de5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 4 deletions

View File

@ -6,7 +6,7 @@ on:
schedule:
- cron: '0 2 * * *'
env:
SW_VERSION: 'v5.0.1'
SW_VERSION: 'v5.0.2'
jobs:
database:
name: Test for Database

View File

@ -14,7 +14,7 @@ jobs:
matrix:
os: [ ubuntu-latest ]
php-version: [ '8.0', '8.1', '8.2' ]
sw-version: [ 'v4.5.11', 'v4.6.7', 'v4.7.1', 'v4.8.12', 'v5.0.1', 'master' ]
sw-version: [ 'v4.5.11', 'v4.6.7', 'v4.7.1', 'v4.8.12', 'v5.0.2', 'master' ]
exclude:
- php-version: '8.1'
sw-version: 'v4.5.11'
@ -57,7 +57,7 @@ jobs:
rm swoole.tar.gz
cd swoole
phpize
if [ _${{ matrix.sw-version }} = '_v5.0.1' ] || [ _${{ matrix.sw-version }} = '_master' ]
if [ _${{ matrix.sw-version }} = '_v5.0.2' ] || [ _${{ matrix.sw-version }} = '_master' ]
then
./configure --enable-openssl --enable-swoole-curl --enable-cares --enable-swoole-pgsql --enable-brotli
else

View File

@ -1,5 +1,9 @@
# v3.0.7 - TBD
## Added
- [#5042](https://github.com/hyperf/hyperf/pull/5402) Added `swagger.scan.paths` to rewrite `scan paths` for swagger.
# v3.0.6 - 2023-02-12
## Fixed

View File

@ -16,4 +16,7 @@ return [
'html' => null,
'url' => '/swagger',
'auto_generate' => true,
'scan' => [
'paths' => null,
],
];

View File

@ -21,7 +21,10 @@ class Generator
public function generate(): void
{
$paths = $this->config->get('annotations.scan.paths', []);
$paths = $this->config->get('swagger.scan.paths', null);
if ($paths === null) {
$paths = $this->config->get('annotations.scan.paths', []);
}
$openapi = \OpenApi\Generator::scan($paths, [
'validate' => false,