next-openapi-gen
Version:
Automatically generate OpenAPI 3.0 documentation from Next.js projects, with support for TypeScript types and Zod schemas.
23 lines (22 loc) • 842 B
JavaScript
import { Command, Option } from "commander";
import { init } from "./commands/init.js";
import { generate } from "./commands/generate.js";
const program = new Command();
program
.name("next-openapi-gen")
.version("0.0.1")
.description("Super fast and easy way to generate OpenAPI documentation for Next.js");
program
.command("init")
.addOption(new Option("-i, --ui <type>", "Specify the UI type, e.g., scalar")
.choices(["scalar", "swagger", "redoc", "stoplight", "rapidoc"])
.default("swagger"))
.option("-u, --docs-url <url>", "Specify the docs URL", "api-docs")
.description("Initialize a openapi specification")
.action(init);
program
.command("generate")
.description("Generate a specification based on api routes")
.action(generate);
program.parse(process.argv);