2.2.3-a • Published 8 years ago

swagger-ui-browserify v2.2.3-a

Weekly downloads
27
License
ISC
Repository
github
Last release
8 years ago

swagger-ui-browserify

Build Status

Use swagger-ui with browserify.

Supports version 2.1.4 and 2.0.24. Why? Because 2.1.3 tries to convert a Swagger 1.2 into a Swagger 2 definition and it's not always a one-to-one mapping - for example see OAI/OpenAPI-Specification#182.

This is the 2.1.4/v2.0 branch. See 2.0.24/v1.2 if you cannot upgrade to v2.0 of the spec.

Installation

$ npm install --save swagger-ui-browserify

Example

// in your app.js file
var SwaggerUi = require('swagger-ui-browserify')

// SwaggerUI expects there to be a `swaggerUi` property on the window object :(
window.swaggerUi = new SwaggerUi({
  url: '/apidocs',
  dom_id: 'swagger-ui-container',
  supportHeaderParams: true,
  onComplete: function (swaggerApi, swaggerUi) {
    console.log('Loaded SwaggerUI')
  },
  onFailure: function (error) {
    console.error('Unable to Load SwaggerUI', error)
  },
  apisSorter: 'alpha',
  operationsSorter: 'alpha',
  docExpansion: 'none'
})
window.swaggerUi.load()

jQuery & Handlebars

SwaggerUI uses old versions of jQuery and Handlebars. If you are also using these libraries on the same page and wish to avoid loading multiple versions of them you should specify the same versions in your package.json file:

LibraryVersion
Handlebars^3.0.3
jQuery^1.9.1

Assets

You will need to make the CSS/images/font assets bundled with swagger-ui available to be referenced from your app's html page. See the example gulpfile.js for more.

2.2.3-a

8 years ago

2.2.3

8 years ago

2.1.4-a

8 years ago

2.0.24-d

8 years ago

2.0.24-c

8 years ago

2.1.4

8 years ago

2.0.24-b

8 years ago

2.1.3-b

8 years ago

2.0.24-a

9 years ago

2.0.24

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

2.1.3-a

9 years ago

2.1.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago