Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pccomponentes/documentation-bundle

The documentation bundle manages the required routes and templates in order to show documentation both in OpenApi and AsyncApi formats.
https://github.com/pccomponentes/documentation-bundle

asyncapi openapi symfony-bundle

Last synced: 24 days ago
JSON representation

The documentation bundle manages the required routes and templates in order to show documentation both in OpenApi and AsyncApi formats.

Awesome Lists containing this project

README

        

Documentation Bundle
====================

The documentation bundle manages the required routes and templates in order to show
documentation both in OpenApi and AsyncApi formats.

Installation
------------

Add the pccomponentes/documentation-bundle package to your require section in the composer.json file.

```bash
$ composer require pccomponentes/documentation-bundle
```

Add the DocumentationBundle to your application's kernel.

```php
['all' => true],
// ...
];
```

Usage
-----

Configure the paths to your YAML files in your config.yml (Both keys are optional).

```yaml
documentation:
openapi: 'docs/openapi.yml'
asyncapi: 'docs/asyncapi.yml'
```

Enable the paths in your routing.yml file.

```yaml
documentation:
resource: '@DocumentationBundle/Resources/config/routing.yaml'
prefix: /docs
```

You can choose a prefix where the documentation will be published.

After this, you should be able to see the Swagger interface at `/openapi` (or `/docs/openapi` if you used the `docs`
prefix), the AsyncApi at `/asyncapi`, and all of your event converters at `/converters`.

Also, you can customize the [SwaggerUI options](https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/)
using the key `swagger_options`, and the [AsyncApi ones](https://github.com/asyncapi/asyncapi-react#web-component)
using `asyncapi_options`, for example:

```yaml
documentation:
openapi: 'docs/openapi.yml'
asyncapi: 'docs/asyncapi.yml'
swagger_options:
deepLinking: true
displayOperationId: true
displayRequestDuration: true
asyncapi_options:
schemaFetchOptions: '{"method":"GET","mode":"cors"}'

```

In addition, you can add your custom links to the homepage using the `links` key, here is an example:

```yaml
documentation:
links:
- title: 'Google'
description: 'You can add some notes for each link'
url: 'https://www.google.com/'
- title: 'Contact PcComponentes'
url: 'https://www.pccomponentes.com/soporte/contactar-con-pccomponentes'
```