# ngauge-api-docs

API documentation module for NGauge (Swagger/OpenAPI UI + JSON).

## Features
- Hosts API docs endpoints previously served by `v1/DocumentationController`
- Preserves legacy scan targets used by `light\\swagger`
- Registers direct v1 compatibility routes for `/v1/documentation/*`

## Installation

```bash
composer require portalpeople/ngauge-api-docs
```

## Configuration

### 1. Register in app config (`backend/config/main.php`)

```php
return [
    'bootstrap' => ['api-docs'],
    'modules' => [
        'api-docs' => [
            'class' => 'portalpeople\\apidocs\\Module',
        ],
    ],
];
```

### 2. Set params in `params.php` or `params-local.php`

```php
return [
    'plugins' => [
        'api-docs' => [
            'apiKey'          => 'your-api-key',       // required for docapi endpoint
            'swaggerScanDirs' => [                      // optional: override default scan paths
                '@api/modules/v1/SwaggerControllers.php',
            ],
        ],
    ],
];
```

`apiKey` should be set in `params-local.php` — never committed to the repository.
If `swaggerScanDirs` is omitted, the module falls back to the default NGauge scan paths.

## Endpoints
- `GET /v1/documentation`
- `GET /v1/documentation/docapi`
- `GET /v1/documentation/page?url=...`
