0.0.5 • Published 7 years ago

openapi-utils-schema-from-api v0.0.5

Weekly downloads
51
License
ISC
Repository
github
Last release
7 years ago

openapi-utils-schema-from-api

JavaScript Style Guide

Extract schema from openapi definition.

Installation

npm install --save openapi-utils-schema-from-api

Usage

var openApiUtils = require('openapi-utils-schema-from-api')

var api = {
  "definitions": {
    "Cat": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        }
      }
    }
  }
}

var schema = openApiUtils.schemaFromApi(api, { 'schema': { '$ref': '#/definitions/Cat' } } )
console.log(schema)
/*
  { type: 'object', properties: { id: { type: 'string' } } }
*/