0.0.1-alpha.2 • Published 4 months ago

@wearebreak/nextjs-openapi-schema v0.0.1-alpha.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@wearebreak/nextjs-openapi-schema

A simple CLI tool to automatically generate OpenAPI schema for Next.js API routes.

Motivation

This is a fork of tazo90/next-openapi-gen, but I am working on a complete rewrite focusing on schema generation and dropping support for UIs. My aim is to support all OpenAPI 3.0 features and infer as much as possible from the TypeScript types.

We are using this tool at We Are Break to generate OpenAPI schemas for our Next.js Apps.

Installation

npm install @wearebreak/nextjs-openapi-schema

Usage

Initialize

Run the following command to create the configuration file.

nextjs-openapi-schema init

Generate

Run the following command to generate the OpenAPI schema.

nextjs-openapi-schema generate

Roadmap

  • Add support for path parameters
  • Add support for documenting path parameters
  • Do not depend on the order of the lines in JSDoc comments
  • Add support for form data
  • Add support for example responses
  • Infer param and body types from TypeScript types
  • Add support for custom tags