Skip to content

Commit

Permalink
Add more notes about doctrine/annotations being optional as of versio…
Browse files Browse the repository at this point in the history
…n 4.8 (#1516)
  • Loading branch information
DerManoMann authored Dec 11, 2023
1 parent 5087638 commit 2a2ae43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions docs/guide/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2a2ae43

Please sign in to comment.