Skip to content
Draft
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
10 changes: 10 additions & 0 deletions src/bundle/ApiPlatform/OpenApiFactory.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check warning on line 1 in src/bundle/ApiPlatform/OpenApiFactory.php

View workflow job for this annotation

GitHub Actions / Run code style check

Found violation(s) of type: static_lambda

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
Expand All @@ -9,10 +9,13 @@
namespace Ibexa\Bundle\Rest\ApiPlatform;

use ApiPlatform\OpenApi\Factory\OpenApiFactoryInterface;
use ApiPlatform\OpenApi\Model\Info;
use ApiPlatform\OpenApi\Model\Operation;
use ApiPlatform\OpenApi\Model\Response;
use ApiPlatform\OpenApi\Model\Tag;
use ApiPlatform\OpenApi\OpenApi;
use ArrayObject;
use Ibexa\Contracts\Core\Ibexa;
use Symfony\Component\HttpKernel\KernelInterface;

final readonly class OpenApiFactory implements OpenApiFactoryInterface
Expand All @@ -30,8 +33,15 @@
public function __invoke(array $context = []): OpenApi
{
$openApi = ($this->decorated)($context);
$openApi = $openApi->withInfo((new Info('Ibexa DXP REST API', Ibexa::VERSION)));
$openApi = $this->addSchemas($openApi);

$tags = $openApi->getTags();
usort($tags, function (Tag $a, Tag $b): int {
return strcmp($a->getName(), $b->getName());
});
$openApi = $openApi->withTags($tags);

$this->insertExampleFilesContent($openApi);

return $openApi;
Expand Down
Loading