npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

restapi-docs

v1.0.5

Published

This package generate openapi specifications and render using a provider like swagger, scaler, and more.

Downloads

181

Readme

RestAPI-Docs

RestAPI-Docs is an npm package that allows you to render OpenAPI specifications using different tools such as Swagger UI, Redoc, RapiDoc, StoplightIO, and Scalar. It can either take an OpenAPI specification URL, file, or generate the specification directly from database model schemas (like Parse Server's /schemas endpoint).

Features

  • Multiple Renderers: Support for Swagger, Redoc, RapiDoc, StoplightIO, and Scalar renderers.
  • Flexible Input Options: Render OpenAPI specs from a URL, local spec file, or generate from Parse Server schemas.
  • CLI Tool: Can be used as a command-line tool or a programmatic package.
  • Easy Integration: Works seamlessly with Parse Server schemas.

Installation

You can install the package using npm:

npm install restapi-docs

Usage

CLI Usage

You can use the CLI to render OpenAPI specs from various sources:

  1. Render from a URL:
restapi-docs openapi --specUrl <openapi-spec-url> --renderer <renderer>

Example:

restapi-docs openapi --specUrl https://api.example.com/openapi.json --renderer swagger
  1. Render from a local spec file:
restapi-docs openapi --specFile <openapi-spec-file> --renderer <renderer>

Example:

restapi-docs openapi --specFile ./openapi.json --renderer scalar

Build OpenAPI Document from Parse Server Schemas:

Creates OpenAPI Specification from Parse-Server schemas.

  1. Render from parse-server schemas:
restapi-docs parse-server --appId <parse-server-app-id> --masterKey <parse-server-master-key> --serverUrl <parse-server-server-url> --renderer <renderer>

Example:

restapi-docs parse-server --appId parse-server-app-id --masterKey parse-server-master-key --serverUrl https://example.com/parse --renderer scalar

Programmatic Usage

You can also use the package programmatically in your Node.js application:

Available Renderers

  • swagger – Swagger UI
  • redoc – Redoc
  • rapidoc – RapiDoc
  • stoplightio – StoplightIO
  • scalar – Scalar

Commands & Options

The following commands with options are available for both the CLI and programmatic usage:

parse-server

  • --appId or appId: Parse-Server Application-ID
  • --masterKey or masterKey: parse-Server Master-Key
  • --serverUrl or serverUrl: URL to the Parse Server

- Example

restapi-docs parse-server --<options>

openapi

  • --specUrl or specUrl: URL to the OpenAPI specification.
  • --specFile or specFile: Path to the local OpenAPI specification file.

- Example

restapi-docs openapi --<options>

Global Options

The following options can be used in-conjuction with all commands.

  • --title or title: A title for specification. It is shown as browser title
  • --desc or desc: A description of the specification.
  • --summary or summary: A summary of the specification.
  • --port or port: The port at which the app will listen in stand-alone mode.
  • --path or path: A path after hostname. The default value /_docs
  • --renderer or -r or provider: Specifies the renderer engine.
    • swagger
    • redoc
    • stoplightio
    • scalar
    • rapidoc