mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Add ability to use response objects which defined in configuration
This commit is contained in:
parent
c805beb3f5
commit
346235de97
@ -87,6 +87,9 @@ final class SwaggerPhpDescriber implements ModelRegistryAwareInterface
|
||||
if (0 === strpos($ref, '#/parameters/') && isset($this->api->getParameters()[substr($ref, 13)])) {
|
||||
return;
|
||||
}
|
||||
if (0 === strpos($ref, '#/responses/') && $this->api->getResponses()->has(substr($ref, 12))) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent::ref($ref);
|
||||
}
|
||||
|
@ -191,6 +191,10 @@ class ApiController
|
||||
* description="Success",
|
||||
* @SWG\Schema(ref="#/definitions/Test")
|
||||
* )
|
||||
* @SWG\Response(
|
||||
* response="201",
|
||||
* ref="#/responses/201"
|
||||
* )
|
||||
* @Route("/configReference", methods={"GET"})
|
||||
*/
|
||||
public function configReferenceAction()
|
||||
|
@ -387,6 +387,7 @@ class FunctionalTest extends WebTestCase
|
||||
{
|
||||
$operation = $this->getOperation('/api/configReference', 'get');
|
||||
$this->assertEquals('#/definitions/Test', $operation->getResponses()->get('200')->getSchema()->getRef());
|
||||
$this->assertEquals('#/responses/201', $operation->getResponses()->get('201')->getRef());
|
||||
}
|
||||
|
||||
public function testOperationsWithOtherAnnotationsAction()
|
||||
|
@ -133,6 +133,11 @@ class TestKernel extends Kernel
|
||||
'required' => true,
|
||||
],
|
||||
],
|
||||
'responses' => [
|
||||
'201' => [
|
||||
'description' => 'Awesome description',
|
||||
],
|
||||
],
|
||||
],
|
||||
'areas' => [
|
||||
'default' => ['path_patterns' => ['^/api(?!/admin)'], 'host_patterns' => ['^api\.']],
|
||||
|
Loading…
x
Reference in New Issue
Block a user