@routup/swagger
Two things in one plugin:
- Generator — walk a TypeScript codebase, extract route metadata via
@trapi/metadata, and emit an OpenAPI v2 or v3 document. - UI — mount Swagger UI at any path to serve the generated document interactively.
Pair with @routup/decorators (controllers and parameter decorators are the source of truth) and @routup/swagger-preset (which teaches the generator how to interpret routup's @D* decorators).
Installation
bash
npm install @routup/swagger @routup/swagger-presetWhen to use it
- You want OpenAPI docs that stay in sync with your handlers — the generator reads the same decorators that mount the routes
- You want Swagger UI inline in the same routup app, no separate process
- You're publishing a public API and need a contract artifact for client codegen
If you're hand-writing your OpenAPI document (or generating it from another source), you only need the UI half — skip the generator and feed swaggerUI() your existing swagger.json / openapi.yaml.
See also
- Generator —
generate(), V2 vs V3, output paths - UI —
swaggerUI(), mounting, custom UI options @routup/swagger-preset— the@trapi/metadatapreset that decodes@DController/@DGet/@DBody@routup/decorators— write controllers in the shape the generator expects