diff --git a/Examples/petstore.swagger.io/petstore.swagger.io.yaml b/Examples/petstore.swagger.io/petstore.swagger.io.yaml index ec62cd3c5..387ac1a12 100644 --- a/Examples/petstore.swagger.io/petstore.swagger.io.yaml +++ b/Examples/petstore.swagger.io/petstore.swagger.io.yaml @@ -116,7 +116,6 @@ paths: tags: - pet summary: 'Updates a pet in the store with form data' - description: '' operationId: updatePetWithForm parameters: - @@ -152,7 +151,6 @@ paths: tags: - pet summary: 'Deletes a pet' - description: '' operationId: deletePet parameters: - @@ -178,7 +176,6 @@ paths: tags: - pet summary: 'Update an existing pet.' - description: '' operationId: updatePet requestBody: description: 'Pet object that needs to be added to the store' @@ -206,7 +203,6 @@ paths: tags: - pet summary: 'Add a new pet to the store' - description: '' operationId: addPet requestBody: description: 'Pet object that needs to be added to the store' @@ -231,7 +227,6 @@ paths: tags: - pet summary: 'uploads an image' - description: '' operationId: uploadFile parameters: - @@ -285,7 +280,6 @@ paths: tags: - store summary: 'Place an order for a pet' - description: '' operationId: placeOrder requestBody: description: 'order placed for purchasing the pet' @@ -367,7 +361,6 @@ paths: tags: - user summary: 'Creates list of users with given input array' - description: '' operationId: createUsersWithArrayInput requestBody: description: 'List of user object' @@ -386,7 +379,6 @@ paths: tags: - user summary: 'Creates list of users with given input array' - description: '' operationId: createUsersWithListInput requestBody: description: 'List of user object' @@ -405,7 +397,6 @@ paths: tags: - user summary: 'Logs user into the system' - description: '' operationId: loginUser parameters: - @@ -442,7 +433,6 @@ paths: tags: - user summary: 'Logs out current logged in user session' - description: '' operationId: logoutUser parameters: [] responses: @@ -453,7 +443,6 @@ paths: tags: - user summary: 'Get user by user name' - description: '' operationId: getUserByName parameters: - diff --git a/composer.json b/composer.json index 023e912f8..25304757c 100644 --- a/composer.json +++ b/composer.json @@ -51,11 +51,6 @@ "symfony/finder": ">=2.2", "symfony/yaml": ">=3.3" }, - "autoload": { - "psr-4": { - "OpenApi\\": "src" - } - }, "require-dev": { "composer/package-versions-deprecated": "^1.11", "doctrine/annotations": "^1.7 || ^2.0", @@ -64,8 +59,10 @@ "phpunit/phpunit": ">=8", "vimeo/psalm": "^4.23" }, - "suggest": { - "doctrine/annotations": "^1.7 || ^2.0" + "autoload": { + "psr-4": { + "OpenApi\\": "src" + } }, "autoload-dev": { "exclude-from-classmap": [ @@ -77,6 +74,12 @@ "AnotherNamespace\\": "tests/Fixtures/AnotherNamespace" } }, + "conflict": { + "symfony/process": ">=6, <6.4.14" + }, + "suggest": { + "doctrine/annotations": "^1.7 || ^2.0" + }, "scripts-descriptions": { "cs": "Fix all codestyle issues", "lint": "Test codestyle", diff --git a/src/Processors/DocBlockDescriptions.php b/src/Processors/DocBlockDescriptions.php index 59070fd34..97d112856 100644 --- a/src/Processors/DocBlockDescriptions.php +++ b/src/Processors/DocBlockDescriptions.php @@ -11,10 +11,10 @@ use OpenApi\Generator; /** - * Checks if the annotation has a summary and/or description property - * and uses the text in the comment block (above the annotations) as summary and/or description. + * Checks if the annotation has a summary and/or description property and uses + * the text in the docblock (above the annotations) as summary and/or description. * - * Use `null`, for example: `@Annotation(description=null)`, if you don't want the annotation to have a description. + * Use an empty string `''`, for example: `@Annotation(description="")`, if you don't want the annotation to have a description. */ class DocBlockDescriptions implements ProcessorInterface { @@ -54,7 +54,7 @@ public function __invoke(Analysis $analysis) protected function description(OA\AbstractAnnotation $annotation): void { if (!Generator::isDefault($annotation->description)) { - if ($annotation->description === null) { + if ($annotation->description === null || $annotation->description === '') { $annotation->description = Generator::UNDEFINED; } @@ -69,8 +69,8 @@ protected function description(OA\AbstractAnnotation $annotation): void */ protected function summaryAndDescription(OA\AbstractAnnotation $annotation): void { - $ignoreSummary = !Generator::isDefault($annotation->summary); - $ignoreDescription = !Generator::isDefault($annotation->description); + $ignoreSummary = !Generator::isDefault($annotation->summary) && $annotation->summary !== ''; + $ignoreDescription = !Generator::isDefault($annotation->description) && $annotation->description !== ''; if ($annotation->summary === null) { $ignoreSummary = true; $annotation->summary = Generator::UNDEFINED;