swagger-enum

1.0.2 • Public • Published

swagger-enum Build Status

Generate readable enum definitions for Swagger

Install

$ npm install --save swagger-enum

Usage

var Enum = require('swagger-enum')
 
Enum({title: 'Status', description: 'The status'}, {
  0: 'off',
  1: 'on'  
})
//=> {title: ..., type: 'integer', description: ...}

The description will be:

The status<ul><li><strong>0: </strong>off</li><li><strong>1: </strong>on</li></ul>

API

Enum([data], values) -> object

data

Required
Type: object

Initial data for the schema.

values

Required
Type: object

An object containing enum values (the keys are integers).

License

MIT © Ben Drucker

Package Sidebar

Install

npm i swagger-enum

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • bendrucker