Fix the detection of references in the RouteMetadataDescriber

This commit is contained in:
Guilhem Niot 2020-11-01 11:41:49 +01:00
parent 2f8416618d
commit e1700ba4b5
3 changed files with 3 additions and 13 deletions

View File

@ -72,6 +72,7 @@ final class RouteMetadataDescriber implements RouteDescriberInterface
{
/** @var OA\Parameter[] $globalParams */
$globalParams = OA\UNDEFINED !== $api->components && OA\UNDEFINED !== $api->components->parameters ? $api->components->parameters : [];
$globalParams = array_column($globalParams, null, 'parameter'); // update the indexes of the array with the reference names actually used
$existingParams = [];
$operationParameters = OA\UNDEFINED !== $operation->parameters ? $operation->parameters : [];

View File

@ -29,16 +29,4 @@ class TestController
public function testAction()
{
}
/**
* @OA\Parameter(ref="#/components/parameters/test"),
* @OA\Response(
* response="200",
* description="Test Ref"
* )
* @Route("/test/{id}", methods={"GET"})
*/
public function testRefAction()
{
}
}

View File

@ -424,7 +424,8 @@ class FunctionalTest extends WebTestCase
public function testNoDuplicatedParameters()
{
$this->assertNotHasParameter('name', 'path', $this->getOperation('/api/article/{id}', 'get'));
$this->assertHasPath('/api/article/{id}', $this->getOpenApiDefinition());
$this->assertNotHasParameter('id', 'path', $this->getOperation('/api/article/{id}', 'get'));
}
public function testSerializedNameAction()