Support references to config parameters

This commit is contained in:
Guilhem Niot 2018-05-10 18:46:48 +02:00
parent 9adca90e45
commit c1fb7abfb8
3 changed files with 11 additions and 0 deletions

View File

@ -84,6 +84,9 @@ final class SwaggerPhpDescriber implements ModelRegistryAwareInterface
if (0 === strpos($ref, '#/definitions/') && $this->api->getDefinitions()->has(substr($ref, 14))) { if (0 === strpos($ref, '#/definitions/') && $this->api->getDefinitions()->has(substr($ref, 14))) {
return; return;
} }
if (0 === strpos($ref, '#/parameters/') && isset($this->api->getParameters()[substr($ref, 13)])) {
return;
}
parent::ref($ref); parent::ref($ref);
} }

View File

@ -37,6 +37,7 @@ class ApiController
* description="Success", * description="Success",
* @SWG\Schema(ref=@Model(type=Article::class, groups={"light"})) * @SWG\Schema(ref=@Model(type=Article::class, groups={"light"}))
* ) * )
* @SWG\Parameter(ref="#/parameters/test")
* @Route("/article/{id}", methods={"GET"}) * @Route("/article/{id}", methods={"GET"})
*/ */
public function fetchArticleAction() public function fetchArticleAction()

View File

@ -126,6 +126,13 @@ class TestKernel extends Kernel
'type' => 'string', 'type' => 'string',
], ],
], ],
'parameters' => [
'test' => [
'name' => 'id',
'in' => 'path',
'required' => true,
],
],
], ],
'areas' => [ 'areas' => [
'default' => ['path_patterns' => ['^/api(?!/admin)'], 'host_patterns' => ['^api\.']], 'default' => ['path_patterns' => ['^/api(?!/admin)'], 'host_patterns' => ['^api\.']],