Add Taxon documentation to OpenAPI specification (#19059)
Some checks are pending
Continuous Integration (Minimal) / Static checks (push) Waiting to run
Continuous Integration (Minimal) / Tests (MariaDB) (push) Blocked by required conditions
Continuous Integration (Minimal) / Tests (MySQL) (push) Blocked by required conditions
Continuous Integration (Minimal) / Javascript Tests (MySQL) (push) Blocked by required conditions
Continuous Integration (Minimal) / Tests (PostgreSQL) (push) Blocked by required conditions
Continuous Integration (Minimal) / Frontend (push) Blocked by required conditions
Continuous Integration (Minimal) / Packages (push) Blocked by required conditions

| Q               | A
|-----------------|-----
| Branch?         | 2.2
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | fixes #19020
| License         | MIT

<!--
 - Bug fixes must be submitted against the 2.2 branch
 - Features and deprecations must be submitted against the 2.3 branch
 - Make sure that the correct base branch is set

To be sure you are not breaking any Backward Compatibilities, check the
documentation:

https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->
This commit is contained in:
Kamil Grygierzec 2026-06-22 08:13:25 +02:00 committed by GitHub
commit 82965303e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,49 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Bundle\ApiBundle\OpenApi\Documentation;
use ApiPlatform\OpenApi\OpenApi;
final class TaxonDocumentationModifier implements DocumentationModifierInterface
{
public function __construct(private string $apiRoute)
{
}
public function modify(OpenApi $docs): OpenApi
{
$path = sprintf('%s/shop/taxons', $this->apiRoute);
$paths = $docs->getPaths();
$pathItem = $paths->getPath($path);
$operation = $pathItem?->getGet();
if (null === $operation) {
return $docs;
}
$operation = $operation
->withSummary('Retrieves the collection of enabled Taxon resources for the current channel.')
->withDescription(
'Returns the direct enabled children of the Menu Taxon configured for the current channel. ' .
"The Menu Taxon is resolved from the active channel configuration. " .
"If no Menu Taxon is configured for the channel, the default code is used.",
)
;
$pathItem = $pathItem->withGet($operation);
$paths->addPath($path, $pathItem);
return $docs->withPaths($paths);
}
}

View file

@ -106,5 +106,10 @@
<service id="sylius_api.open_api.documentation_modifier.address_log_entry" class="Sylius\Bundle\ApiBundle\OpenApi\Documentation\AddressLogEntryDocumentationModifier">
<tag name="sylius.open_api.modifier" />
</service>
<service id="sylius_api.open_api.documentation_modifier.taxon" class="Sylius\Bundle\ApiBundle\OpenApi\Documentation\TaxonDocumentationModifier">
<argument>%sylius.security.api_route%</argument>
<tag name="sylius.open_api.modifier" />
</service>
</services>
</container>