Quick Start
Installation
Ensure that hono and zod are installed in your project, then install the package:
bash
npm install @mmtq/hono-swaggerConfigure the Generator
Create an openapi.config.ts file in the root of your project:
typescript
export default {
info: {
title: 'My Hono API',
version: '1.0.0',
description: 'Documentation generated at build-time!'
},
servers: [
{ url: 'http://localhost:3000', description: 'Local Server' }
],
include: ['src/**/*.ts'], // Where your Hono routes live
exclude: ['src/**/*.spec.ts'], // Files to ignore during scanning
outputDir: 'docs', // Where the generated openapi.json and static UI will be saved
formats: ['json'],
swaggerUi: true // Set to false to disable generating static Swagger UI HTML
};Note: The CLI natively loads
.ts configuration files out of the box using jiti, no need to compile it to JS or run via tsx!