diff --git a/Extractor/ApiDocExtractor.php b/Extractor/ApiDocExtractor.php index c0a325c..bcbfc2f 100644 --- a/Extractor/ApiDocExtractor.php +++ b/Extractor/ApiDocExtractor.php @@ -341,7 +341,7 @@ class ApiDocExtractor { foreach ($this->reader->getMethodAnnotations($method) as $annot) { if (is_a($annot, self::FOS_REST_QUERY_PARAM_CLASS)) { - if ($annot->strict) { + if ($annot->strict && $annot->default === null) { $annotation->addRequirement($annot->name, array( 'requirement' => $annot->requirements, 'dataType' => '', @@ -355,7 +355,7 @@ class ApiDocExtractor } } elseif (is_a($annot, self::FOS_REST_REQUEST_PARAM_CLASS)) { $annotation->addParameter($annot->name, array( - 'required' => !$annot->nullable, + 'required' => $annot->strict && $annot->default === null, 'dataType' => $annot->requirements, 'description' => $annot->description, 'readonly' => false diff --git a/Tests/Fixtures/Controller/TestController.php b/Tests/Fixtures/Controller/TestController.php index 38d7fe1..de1f0b1 100644 --- a/Tests/Fixtures/Controller/TestController.php +++ b/Tests/Fixtures/Controller/TestController.php @@ -114,7 +114,7 @@ class TestController /** * @ApiDoc() - * @RequestParam(name="param1", requirements="string", nullable=false, description="Param1 description.") + * @RequestParam(name="param1", requirements="string", description="Param1 description.") */ public function zActionWithRequestParamAction() {