From 0525725ddcc6eb9716c7a5fa6325646fee2cd6ca Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 11 Mar 2025 15:43:20 +0100 Subject: [PATCH 1/3] OpenApiFactory.php: Start setting OpenAPI schema info info: title: 'Ibexa DXP REST API' description: 'TODO: Description' version: 5.0.0 --- src/bundle/ApiPlatform/OpenApiFactory.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bundle/ApiPlatform/OpenApiFactory.php b/src/bundle/ApiPlatform/OpenApiFactory.php index 85ce93550..a50299d9b 100644 --- a/src/bundle/ApiPlatform/OpenApiFactory.php +++ b/src/bundle/ApiPlatform/OpenApiFactory.php @@ -9,10 +9,12 @@ 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\OpenApi; use ArrayObject; +use Ibexa\Contracts\Core\Ibexa; use Symfony\Component\HttpKernel\KernelInterface; final readonly class OpenApiFactory implements OpenApiFactoryInterface @@ -30,6 +32,7 @@ public function __construct( public function __invoke(array $context = []): OpenApi { $openApi = ($this->decorated)($context); + $openApi = $openApi->withInfo((new Info('Ibexa DXP REST API', Ibexa::VERSION, 'TODO: Description'))); $openApi = $this->addSchemas($openApi); $this->insertExampleFilesContent($openApi); From c287215d962a421f0d091099aa0493255b73a2dd Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 18 Mar 2025 10:12:01 +0100 Subject: [PATCH 2/3] Update src/bundle/ApiPlatform/OpenApiFactory.php --- src/bundle/ApiPlatform/OpenApiFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bundle/ApiPlatform/OpenApiFactory.php b/src/bundle/ApiPlatform/OpenApiFactory.php index a50299d9b..faf7385d1 100644 --- a/src/bundle/ApiPlatform/OpenApiFactory.php +++ b/src/bundle/ApiPlatform/OpenApiFactory.php @@ -32,7 +32,7 @@ public function __construct( public function __invoke(array $context = []): OpenApi { $openApi = ($this->decorated)($context); - $openApi = $openApi->withInfo((new Info('Ibexa DXP REST API', Ibexa::VERSION, 'TODO: Description'))); + $openApi = $openApi->withInfo((new Info('Ibexa DXP REST API', Ibexa::VERSION))); $openApi = $this->addSchemas($openApi); $this->insertExampleFilesContent($openApi); From 395fd7e2d4feafb809e30b0f12fa1d2284d1e93c Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 18 Mar 2025 11:10:38 +0100 Subject: [PATCH 3/3] OpenApiFactory.php: Sort tags alphabetically --- src/bundle/ApiPlatform/OpenApiFactory.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bundle/ApiPlatform/OpenApiFactory.php b/src/bundle/ApiPlatform/OpenApiFactory.php index faf7385d1..1f4d17715 100644 --- a/src/bundle/ApiPlatform/OpenApiFactory.php +++ b/src/bundle/ApiPlatform/OpenApiFactory.php @@ -12,6 +12,7 @@ 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; @@ -35,6 +36,12 @@ public function __invoke(array $context = []): OpenApi $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;