diff --git a/Formatter/SwaggerFormatter.php b/Formatter/SwaggerFormatter.php index 3ab0cef..6b9cb53 100644 --- a/Formatter/SwaggerFormatter.php +++ b/Formatter/SwaggerFormatter.php @@ -360,7 +360,8 @@ class SwaggerFormatter implements FormatterInterface $prop['subType'], isset($prop['children']) ? $prop['children'] : null, $prop['description'] ?: $prop['dataType'], - $models); + $models + ); break; } } @@ -396,6 +397,10 @@ class SwaggerFormatter implements FormatterInterface $parameter['enum'] = $enum; } + if ($prop['default'] !== null) { + $parameter['defaultValue'] = $prop['default']; + } + $parameters[] = $parameter; } diff --git a/Tests/Formatter/SwaggerFormatterTest.php b/Tests/Formatter/SwaggerFormatterTest.php index d8f543f..488849b 100644 --- a/Tests/Formatter/SwaggerFormatterTest.php +++ b/Tests/Formatter/SwaggerFormatterTest.php @@ -230,7 +230,6 @@ class SwaggerFormatterTest extends WebTestCase ), 'responseMessages' => array( - array( 'code' => 200, 'message' => 'See standard HTTP status code reason for 200', @@ -650,12 +649,14 @@ With multiple lines.', 'paramType' => 'form', 'name' => 'c', 'type' => 'boolean', + 'defaultValue' => false, ), array ( 'paramType' => 'form', 'name' => 'd', 'type' => 'string', + 'defaultValue' => 'DefaultTest', ), ), 'responseMessages' => @@ -693,12 +694,14 @@ With multiple lines.', 'paramType' => 'form', 'name' => 'c', 'type' => 'boolean', + 'defaultValue' => false, ), array ( 'paramType' => 'form', 'name' => 'd', 'type' => 'string', + 'defaultValue' => 'DefaultTest', ), ), 'responseMessages' =>