swagger-enum

Generate readable enum definitions for Swagger


Keywords
swagger, json, schema, markdown, enum, documentation, openapi
License
MIT
Install
npm install swagger-enum@1.0.1

Documentation

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