Merge pull request #1322 from nelmio/params

Support references to config parameters
This commit is contained in:
David Buchmann 2018-05-11 10:43:37 +02:00 committed by GitHub
commit d79dc5922d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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))) {
return;
}
if (0 === strpos($ref, '#/parameters/') && isset($this->api->getParameters()[substr($ref, 13)])) {
return;
}
parent::ref($ref);
}

View File

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

View File

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