This commit is contained in:
1 parent
afcb2e8449
commit
f83d36e64f
3 files changed
+281
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user