Add more notes about doctrine/annotations being optional as of version 4.8 (#1516)

This commit is contained in:
Martin Rademacher 2023-12-11 21:35:08 +13:00 committed by GitHub
parent 5087638d54
commit 2a2ae43496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -5,7 +5,7 @@
# swagger-php
Generate interactive [OpenAPI](https://www.openapis.org) documentation for your RESTful API using
[doctrine annotations](https://www.doctrine-project.org/projects/annotations.html) (optional as of version 4.8)
[doctrine annotations](https://www.doctrine-project.org/projects/annotations.html) (optional as of version 4.8; if required the `doctrine/annotations` library must be installed in addition to swagger.php).
or [PHP attributes](https://www.php.net/manual/en/language.attributes.overview.php).
For a full list of supported annotations, please have look at the [`OpenApi\Annotations` namespace](src/Annotations) or the [documentation website](https://zircote.github.io/swagger-php/guide/annotations.html).
@ -46,6 +46,11 @@ composer global require zircote/swagger-php
### doctrine/annotations
As of version `4.8` the [doctrine annotations](https://www.doctrine-project.org/projects/annotations.html) library **is optional** and **no longer installed by default**.
To use PHPDoc annotations this needs to be installed on top of `swagger-php`:
```shell
composer require doctrine/annotations
```
If your code uses PHPDoc annotations you will need to install this as well:
```shell

View File

@ -46,6 +46,13 @@ class OpenApiSpec
}
```
**As of version 4.8 the `doctrine/annotations` library is optional and might cause the same message.**
If this is the case, `doctrine annotations` must be installed separately:
```shell
composer require doctrine/annotations
```
## Annotations missing
Another side effect of using reflection is that `swagger-php` _"can't see"_ multiple consecutive docblocks any more as the PHP reflection API only provides access to the docblock closest to a given structural element.