JSPM

@wearebreak/nextjs-openapi-schema

0.0.1-alpha.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q21197F
  • License MIT

Generate OpenAPI schema automatically from API routes in NextJS.

Package Exports

  • @wearebreak/nextjs-openapi-schema
  • @wearebreak/nextjs-openapi-schema/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@wearebreak/nextjs-openapi-schema) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@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