alepha@docs:~/docs/reference/primitives$
cat $swagger.md1 min read
#$swagger
#Import
typescript
1import { $swagger } from "alepha/server/swagger";
#Overview
Creates an OpenAPI/Swagger documentation primitive with interactive UI.
Automatically generates API documentation from your $action primitives and serves an interactive Swagger UI for testing endpoints. Supports customization, tag filtering, and OAuth configuration.
#Options
| Option | Type | Required | Description |
|---|---|---|---|
info |
OpenApiDocument["info"] |
No | |
prefix |
string |
No | |
disabled |
boolean |
No | If true, docs will be disabled. |
excludeTags |
string[] |
No | Tags to exclude from the documentation. |
servers |
OpenApiServer[] |
No | Server URLs for the API |
ui |
boolean | SwaggerUiOptions |
No | Enable Swagger UI. |
rewrite |
Object |
No | Function to rewrite the OpenAPI document before serving it. |
#Examples
ts
1class App { 2 docs = $swagger({ 3 prefix: "/api-docs", 4 info: { 5 title: "My API", 6 version: "1.0.0", 7 description: "REST API documentation" 8 }, 9 excludeTags: ["internal"],10 ui: { root: "/swagger" }11 });12}