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

bootprint-openapi

v4.0.4

Published

Converts a openapi-definition into a static html page

Downloads

6,487

Readme

bootprint-openapi

NPM version

Converts a openapi-definition into a static html page

Maintainers / Contributors wanted

I'm still looking for people to help me with the bootprint project. I have found some new ambitions to make bootprint-openapi the greatest offline documentation generator for OpenAPI specifications. I have started, by releasing the current version as 1.0 to show that it's time to start using semver for versioning.

I have created a Twitter account @bootprintjs that will now be used for announcments and for gathering user feedback. I also plan to setup a blog.

But I might still need your help. I am, for example, certain, that there are greater designers out there than me and I feel that some parts of bootprint-openapi need a redesign. So:

  • If you want to start maintaining the module(s), please let me know and I'll give you push access.
  • I will help you by giving pointers to code-lines that need to be changed for a given feature.
  • I will try to publish new versions as fast as possible.
  • I might also give you publishing-rights on npm, although that seems like a large step and I would have to be confident that you don't misuse it.

Overview

This package contains a template, partials and styles for bootprint to convert OpenAPI-Specifications into a static HTML-page.

This package was formerly known as bootprint-swagger and has been renamed, because Swagger-Specification has been renamed to OpenAPI-Specification

Installation

In order to use bootprint-openapi from the command line you have to install bootprint and bootprint-openapi globally:

npm install -g bootprint
npm install -g bootprint-openapi

Check this out: You can now try out the new bootprint-openapi playground. Just paste a OpenAPI-specification and make it readable.

Usage

bootprint openapi http://petstore.swagger.io/v2/swagger.json target

The directory "target" should now contain a file index.html and main.css which contain a readable form of the Swagger-Petstore-Example.

For details about command line parameters, please refer to the documentation of Bootprint

bootprint-openapi is just a template-module for bootprint. That means, it contains LessCss-file, Handlebars-partials and a preprocessor that converts an OpenAPI-Specification into the JSON actually needed by the templates.

Create a single file.

If you want to have a single HTML-file, not one HTML and one CSS, you can use substack's html-inline package to generate a self-cotnained file:

npm -g install html-inline
html-inline target/index.html

Javascript-Usage

The does essentially the same, just in a the above command line, just in JavaScript (i.e. node)

// Load bootprint
require('bootprint')
  // Load bootprint-swagger
  .load(require('bootprint-openapi'))
  // Customize configuration, override any options
  .merge({
    /* Any other configuration */
  })
  // Specify build source and target
  .build('http://petstore.swagger.io/v2/swagger.json', 'target')
  // Generate swagger-documentation into "target" directory
  .generate()
  .done(console.log)

API

The API of bootprint-openapi consists of Handlebars-partials that can be overridden and LessCss-Definitions, that can be adapted.

Handlebars partials

About 26 Handlebars partials are used to render this openapi-html-page. The following documentation is not final yet and there are a lot of partials without real documentation, but you may already have a look at it: The partials documentation describes the partials in use and the order in which they are called. You can override these partials in a Bootprint configuration file.

License

bootprint-openapi is published under the MIT-license. See LICENSE for details.

Some of the example specs have been provided by contributors who opened issues on github, those files are in the test/*-directories.

  • test/all-of/swagger.json msh321 (issue #35)
  • test/missing-items/swagger.json yewton (issue #44)
  • test/path-parameters/swagger.json asieira (issue #18)
  • test/read-only-property/swagger.json asieira (issue #28)

Release-Notes

For release notes, see CHANGELOG.md

Contributing guidelines

See CONTRIBUTING.md.