-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(OpenApi): Fixed
getByPath
operation overlap with get
by setti…
…ng `id` request attribute and api_resource operation configuration
- Loading branch information
1 parent
22ed7f5
commit 54a378d
Showing
7 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
lib/RoadizCoreBundle/src/Api/OpenApi/WebResponseDecorator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RZ\Roadiz\CoreBundle\Api\OpenApi; | ||
|
||
use ApiPlatform\OpenApi\Factory\OpenApiFactoryInterface; | ||
use ApiPlatform\OpenApi\Model; | ||
use ApiPlatform\OpenApi\OpenApi; | ||
|
||
final class WebResponseDecorator implements OpenApiFactoryInterface | ||
{ | ||
private OpenApiFactoryInterface $decorated; | ||
|
||
public function __construct( | ||
OpenApiFactoryInterface $decorated | ||
) { | ||
$this->decorated = $decorated; | ||
} | ||
|
||
public function __invoke(array $context = []): OpenApi | ||
{ | ||
$openApi = ($this->decorated)($context); | ||
$schemas = $openApi->getComponents()->getSchemas(); | ||
$pathItem = $openApi->getPaths()->getPath('/api/web_response_by_path'); | ||
$operation = $pathItem->getGet(); | ||
|
||
$openApi->getPaths()->addPath('/api/web_response_by_path', $pathItem->withGet( | ||
$operation->withParameters([new Model\Parameter( | ||
'path', | ||
'query', | ||
'Resource path, or `/` for home page', | ||
true, | ||
)]) | ||
)); | ||
|
||
return $openApi; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters