UNPKG

api-spec-converter

Version:

Convert API descriptions between popular formats such as OpenAPI(fka Swagger), RAML, API Blueprint, WADL, etc.

37 lines (26 loc) 927 B
'use strict'; var Inherits = require('util').inherits; var Promise = require('bluebird'); var BaseFormat = require('../base_format.js'); var Util = require('../util.js'); var Google2Swagger = require('google-discovery-to-swagger'); var Google = module.exports = function() { Google.super_.apply(this, arguments); this.format = 'google'; this.converters.swagger_2 = Promise.method(google => Google2Swagger.convert(google.spec)); this.converters.openapi_3 = Promise.method(google => this.convertTransitive(['swagger_2', 'openapi_3'])); } Inherits(Google, BaseFormat); Google.prototype.formatName = 'google'; Google.prototype.supportedVersions = ['v1']; Google.prototype.getFormatVersion = function () { return Google2Swagger.getVersion(this.spec); } Google.prototype.parsers = { 'JSON': Util.parseJSON }; Google.prototype.checkFormat = function (spec) { return Google2Swagger.checkFormat(spec); }