Skip to content

Commit

Permalink
Use only swagger-php:5
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkaOnLine committed Feb 7, 2025
1 parent df243e8 commit afdb026
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 32 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/test-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: true
matrix:
php: [ '8.0', '8.1', '8.2', '8.3' ]
l5-swagger-flags: ['latest', 'swagger-php-3', 'swagger-ui-3']
l5-swagger-flags: ['latest']

name: PHP ${{ matrix.php }} - ${{ matrix.l5-swagger-flags }}

Expand All @@ -40,14 +40,6 @@ jobs:
- name: Install dependencies
run: composer update --no-interaction --no-progress --prefer-dist --prefer-stable

- name: Require Swagger PHP 3.*
run: composer require 'zircote/swagger-php:3.*' --no-interaction --no-update
if: matrix.l5-swagger-flags == 'swagger-php-3'

- name: Require Swagger UI 3.*
run: composer require 'swagger-api/swagger-ui:3.*' --no-interaction --no-update
if: matrix.l5-swagger-flags == 'swagger-ui-3'

- name: Prepare enviroment
run: |
sudo chown -R $USER:$USER .
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ RUN apt-get update && apt-get install -y \
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# RUN pecl install memcached

RUN pecl install -f xdebug \
&& docker-php-ext-enable xdebug

Expand Down
30 changes: 15 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,6 @@
"email": "darius@matulionis.lt"
}
],
"require": {
"php": "^8.0",
"laravel/framework": "^11.0 || ^10.0 || ^9.0",
"zircote/swagger-php": "^3.2.0 || ^4.0.0",
"swagger-api/swagger-ui": "^3.0 || >=4.1.3",
"symfony/yaml": "^5.0 || ^6.0 || ^7.0",
"ext-json": "*",
"doctrine/annotations": "^1.0 || ^2.0"
},
"require-dev": {
"phpunit/phpunit": "^11.0 || ^10.0 || ^9.5",
"mockery/mockery": "1.*",
"orchestra/testbench": "^9.0 || ^8.0 || 7.* || ^6.15 || 5.*",
"php-coveralls/php-coveralls": "^2.0"
},
"autoload": {
"psr-4": {
"L5Swagger\\": "src"
Expand All @@ -46,6 +31,21 @@
"Tests\\": "tests"
}
},
"require": {
"php": "^8.0",
"laravel/framework": "^11.0 || ^10.0 || ^9.0",
"zircote/swagger-php": "^5.0.0",
"swagger-api/swagger-ui": ">=5.18.3",
"symfony/yaml": "^5.0 || ^6.0 || ^7.0",
"ext-json": "*",
"doctrine/annotations": "^1.0 || ^2.0"
},
"require-dev": {
"phpunit/phpunit": "^11.0 || ^10.0 || ^9.5",
"mockery/mockery": "1.*",
"orchestra/testbench": "^9.0 || ^8.0 || 7.* || ^6.15 || 5.*",
"php-coveralls/php-coveralls": "^2.0"
},
"extra": {
"laravel": {
"providers": [
Expand Down
3 changes: 0 additions & 3 deletions docker/php/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1921,9 +1921,6 @@ xdebug.remote_handler = dbgp
xdebug.discover_client_host = 0
xdebug.show_error_trace = 1

[memcached]
extension=memcached.so

; Local Variables:
; tab-width: 4
; End:
5 changes: 3 additions & 2 deletions src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use OpenApi\Annotations\OpenApi;
use OpenApi\Annotations\Server;
use OpenApi\Generator as OpenApiGenerator;
use OpenApi\Pipeline;
use OpenApi\Util;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Yaml\Dumper as YamlDumper;
Expand Down Expand Up @@ -235,7 +236,7 @@ protected function setProcessors(OpenApiGenerator $generator): void
$processorClasses = Arr::get($this->scanOptions, self::SCAN_OPTION_PROCESSORS, []);
$processors = [];

foreach ($generator->getProcessors() as $processor) {
foreach ($generator->getProcessorPipeline() as $processor) {
$processors[] = $processor;
if ($processor instanceof \OpenApi\Processors\BuildPaths) {
foreach ($processorClasses as $customProcessor) {
Expand All @@ -245,7 +246,7 @@ protected function setProcessors(OpenApiGenerator $generator): void
}

if (! empty($processors)) {
$generator->setProcessors($processors);
$generator->setProcessorPipeline(new Pipeline($processors));
}
}

Expand Down
6 changes: 5 additions & 1 deletion tests/GeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
use L5Swagger\Generator;
use L5Swagger\GeneratorFactory;
use L5Swagger\L5SwaggerServiceProvider;
use OpenApi\Analysers\AttributeAnnotationFactory;
use OpenApi\Analysers\DocBlockAnnotationFactory;
use OpenApi\Analysers\ReflectionAnalyser;
use OpenApi\Analysers\TokenAnalyser;
use OpenApi\Analysers\TokenScanner;
use OpenApi\Processors\CleanUnmerged;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\TestDox;
Expand Down Expand Up @@ -191,7 +195,7 @@ public function testCanGenerateWithScanOptions(): void

$cfg['scanOptions']['exclude'] = [__DIR__.'/storage/annotations/OpenApi/Clients'];
$cfg['scanOptions']['pattern'] = 'L5SwaggerAnnotationsExample*.*';
$cfg['scanOptions']['analyser'] = new TokenAnalyser;
$cfg['scanOptions']['analyser'] = new ReflectionAnalyser([new AttributeAnnotationFactory(), new DocBlockAnnotationFactory()]);
$cfg['scanOptions']['open_api_spec_version'] = '3.1.0';
$cfg['scanOptions']['processors'] = [new CleanUnmerged];
$cfg['scanOptions']['default_processors_configuration'] = ['operationId' => ['hash' => false]];
Expand Down

0 comments on commit afdb026

Please sign in to comment.