Skip to content

Commit c7fabb1

Browse files
committed
docs: simplify openapi config with symfony
1 parent fd44e8f commit c7fabb1

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

core/openapi.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,16 @@ need to decorate `api_platform.openapi.factory`.
7777
In the following example, we will see how to override the title and the base path URL of the Swagger documentation and add a custom filter for
7878
the `GET` operation of `/foos` path.
7979

80-
```yaml
81-
# api/config/services.yaml
82-
App\OpenApi\OpenApiFactory:
83-
decorates: 'api_platform.openapi.factory'
84-
arguments: ['@App\OpenApi\OpenApiFactory.inner']
85-
autoconfigure: false
86-
```
87-
8880
```php
8981
<?php
9082
namespace App\OpenApi;
9183

9284
use ApiPlatform\OpenApi\Factory\OpenApiFactoryInterface;
9385
use ApiPlatform\OpenApi\OpenApi;
9486
use ApiPlatform\OpenApi\Model;
87+
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
9588

89+
#[AsDecorator(decorates: 'api_platform.openapi.factory')]
9690
class OpenApiFactory implements OpenApiFactoryInterface
9791
{
9892

0 commit comments

Comments
 (0)