Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Action/EntrypointAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ final class EntrypointAction
public function __construct(
private readonly ResourceNameCollectionFactoryInterface $resourceNameCollectionFactory,
private readonly ?ProviderInterface $provider = null,
private readonly ?ProcessorInterface $processor = null
private readonly ?ProcessorInterface $processor = null,
private readonly array $documentationFormats = []
) {
}

Expand All @@ -42,7 +43,7 @@ public function __invoke(Request $request = null)
{
if ($this->provider && $this->processor) {
$context = ['request' => $request];
$operation = new Get(read: true, serialize: true, class: Entrypoint::class, provider: fn () => new Entrypoint($this->resourceNameCollectionFactory->create()));
$operation = new Get(outputFormats: $this->documentationFormats, read: true, serialize: true, class: Entrypoint::class, provider: fn () => new Entrypoint($this->resourceNameCollectionFactory->create()));
$body = $this->provider->provide($operation, [], $context);

return $this->processor->process($body, $operation, [], $context);
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Bundle/Resources/config/api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
<argument type="service" id="api_platform.metadata.resource.name_collection_factory" />
<argument type="service" id="api_platform.state_provider.main" on-invalid="null" />
<argument type="service" id="api_platform.state_processor.main" on-invalid="null" />
<argument>%api_platform.docs_formats%</argument>
</service>

<service id="api_platform.action.documentation" class="ApiPlatform\Documentation\Action\DocumentationAction" public="true">
Expand Down
2 changes: 2 additions & 0 deletions tests/Fixtures/app/config/config_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ api_platform:
jsonopenapi: ['application/vnd.openapi+json']
yamlopenapi: ['application/vnd.openapi+yaml']
jsonld: ['application/ld+json']
jsonhal: ['application/hal+json']
jsonapi: ['application/vnd.api+json']
error_formats:
jsonproblem: ['application/problem+json']
jsonld: ['application/ld+json']
Expand Down