@telenorfrontend/metalsmith-swagger-ui

0.1.1 • Public • Published

metalsmith-swagger-ui

A Metalsmith plugin to embed Swagger UI in place of Open API spec files.

Installation

$ npm install --save @telenor-frontend/metalsmith-swagger-ui

Javascript Usage

Pass options to the plugin and pass it to Metalsmith with the use method:

const swaggerui = require('metalsmith-swagger-ui');

metalsmith.use(swaggerui({
  template: path.join(__dirname, 'assets/template.hbs'),
}));

Defaults are shown in the example above, all options are optional.

Options

template: A handlebars template that the plugin should use to generate the embed.

Including assets

Make sure to include all the necessary assets (swagger-ui.css, swagger-ui-bundle.js, swagger-ui-standalone-preset.js) on the page where Swagger UI will be embedded.

The necessary assets can be obtained from the swagger-ui-dist package.

Configuration

You can modify the look and feel of metalsmith-swagger-ui by passing a custom handlebars template in the options, overriding/rewriting the Swagger UI css style, or by using a different Swagger UI layout.

License

Apache-2.0

Readme

Keywords

none

Package Sidebar

Install

npm i @telenorfrontend/metalsmith-swagger-ui

Weekly Downloads

5

Version

0.1.1

License

Apache-2.0

Last publish

Collaborators

  • td-travis-ci
  • pkkummermo