Skip to content

Commit 171c1d6

Browse files
committed
document openapi tags
1 parent e751b7e commit 171c1d6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

core/openapi.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,26 @@ It is also possible to use OpenAPI v3.0.0 format:
5050
bin/console api:openapi:export --spec-version=3.0.0
5151
```
5252

53+
## Create several versions of a specification
54+
55+
You can now decline a same OpenAPI specification in multiple versions using the `x-apiplatform-tags` tag:
56+
57+
```php
58+
use ApiPlatform\OpenApi\Factory\OpenApiFactory;
59+
60+
#[GetCollection(openapi: new Operation(extensionProperties: [OpenApiFactory::API_PLATFORM_TAG => ['customer', 'developer']]))]
61+
#[Post(openapi: new Operation(extensionProperties: [OpenApiFactory::API_PLATFORM_TAG => 'developer']))]
62+
class Book {}
63+
```
64+
65+
Then, either use the query parameter for the web version such as `/docs?filter_tags[]=customer` or through the command line:
66+
67+
```
68+
bin/console api:openapi:export --filter-tags=customer
69+
```
70+
71+
To produce a specification including only the operation matching your tag.
72+
5373
## Overriding the OpenAPI Specification
5474

5575
### Overriding the OpenAPI Specification with Symfony

0 commit comments

Comments
 (0)