1.0.2 • Published 8 years ago

swagger-enum v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

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