Update for latest FOSRestBundle

This commit is contained in:
Jordi Boggiano 2013-02-15 11:37:02 +01:00
parent c946fbcf4f
commit e3a8fc6df0
2 changed files with 3 additions and 3 deletions

View File

@ -341,7 +341,7 @@ class ApiDocExtractor
{ {
foreach ($this->reader->getMethodAnnotations($method) as $annot) { foreach ($this->reader->getMethodAnnotations($method) as $annot) {
if (is_a($annot, self::FOS_REST_QUERY_PARAM_CLASS)) { if (is_a($annot, self::FOS_REST_QUERY_PARAM_CLASS)) {
if ($annot->strict) { if ($annot->strict && $annot->default === null) {
$annotation->addRequirement($annot->name, array( $annotation->addRequirement($annot->name, array(
'requirement' => $annot->requirements, 'requirement' => $annot->requirements,
'dataType' => '', 'dataType' => '',
@ -355,7 +355,7 @@ class ApiDocExtractor
} }
} elseif (is_a($annot, self::FOS_REST_REQUEST_PARAM_CLASS)) { } elseif (is_a($annot, self::FOS_REST_REQUEST_PARAM_CLASS)) {
$annotation->addParameter($annot->name, array( $annotation->addParameter($annot->name, array(
'required' => !$annot->nullable, 'required' => $annot->strict && $annot->default === null,
'dataType' => $annot->requirements, 'dataType' => $annot->requirements,
'description' => $annot->description, 'description' => $annot->description,
'readonly' => false 'readonly' => false

View File

@ -114,7 +114,7 @@ class TestController
/** /**
* @ApiDoc() * @ApiDoc()
* @RequestParam(name="param1", requirements="string", nullable=false, description="Param1 description.") * @RequestParam(name="param1", requirements="string", description="Param1 description.")
*/ */
public function zActionWithRequestParamAction() public function zActionWithRequestParamAction()
{ {