feat: generate OpenAPI from registered routes
Tests / PHP 8.4 (push) Failing after 1m37s

This commit is contained in:
dgarcia committed 2026-11-15 14:14:12 -03:00
1 parent afcb2e8449
commit f83d36e64f
3 files changed
+281

No files matched your search

+21
View File
@@ -33,6 +33,27 @@ own ports; if an application uses an ORM, it connects it by composition.
composer require camelia/controllers
```
## OpenAPI
`OpenApi::register()` derives an OpenAPI 3.0 document from the routes already registered on a
router and serves it under a prefix:
```php
use Camelia\Controllers\{OpenApi, Router};
$router = new Router();
$router->get('/articulos/{id}', /* handler */);
OpenApi::register($router, '/docs/', ['title' => 'Facturación', 'version' => '2.0.0']);
```
- `GET /docs/` serves an HTML viewer with the document inline.
- `GET /docs/openapi.json` serves the raw document.
The document describes paths, methods and path parameters. It has no request or response schemas:
the library holds no payload metadata, and deriving it here would duplicate what the application
already knows.
## Documentation
The full developer guide, organised by task, is in