Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading