diff --git a/Formatter/SwaggerFormatter.php b/Formatter/SwaggerFormatter.php index 078f098..3ab0cef 100644 --- a/Formatter/SwaggerFormatter.php +++ b/Formatter/SwaggerFormatter.php @@ -246,6 +246,8 @@ class SwaggerFormatter implements FormatterInterface ); } + $type = isset($responseMessages[200]['responseModel']) ? $responseMessages[200]['responseModel'] : null; + foreach ($apiDoc->getRoute()->getMethods() as $method) { $operation = array( 'method' => $method, @@ -255,6 +257,10 @@ class SwaggerFormatter implements FormatterInterface 'responseMessages' => array_values($responseMessages), ); + if ($type !== null) { + $operation['type'] = $type; + } + $apiBag[$path][] = $operation; } } diff --git a/Tests/Formatter/SwaggerFormatterTest.php b/Tests/Formatter/SwaggerFormatterTest.php index 7a03171..d8f543f 100644 --- a/Tests/Formatter/SwaggerFormatterTest.php +++ b/Tests/Formatter/SwaggerFormatterTest.php @@ -237,6 +237,7 @@ class SwaggerFormatterTest extends WebTestCase 'responseModel' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested', ), ), + 'type' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested', ), ), ),