swagger-converter
Advanced tools
Comparing version 0.1.2 to 0.1.3
{ | ||
"name": "swagger-converter", | ||
"main": "index.js", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"homepage": "https://github.com/apigee-127/swagger-converter", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -1,2 +0,2 @@ | ||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){var urlParse=require("url").parse;var clone=require("lodash.clonedeep");if(typeof window==="undefined"){module.exports=convert}else{window.SwaggerConverter=window.SwaggerConverter||{convert:convert}}function convert(resourceListing,apiDeclarations){if(typeof resourceListing!=="object"){throw new Error("resourceListing must be an object")}if(!Array.isArray(apiDeclarations)){apiDeclarations=[]}var convertedSecurityNames={};var models={};var result={swagger:"2.0",info:buildInfo(resourceListing),paths:{}};if(resourceListing.authorizations){result.securityDefinitions=buildSecurityDefinitions(resourceListing,convertedSecurityNames)}if(resourceListing.basePath){assignPathComponents(resourceListing.basePath,result)}extend(models,resourceListing.models);if(Array.isArray(resourceListing.apis)){resourceListing.apis.forEach(function(api){if(Array.isArray(api.operations)){result.paths[api.path]=buildPath(api,resourceListing)}})}apiDeclarations.forEach(function(apiDeclaration){if(apiDeclaration.basePath){assignPathComponents(apiDeclaration.basePath,result)}if(!Array.isArray(apiDeclaration.apis)){return}apiDeclaration.apis.forEach(function(api){result.paths[api.path]=buildPath(api,apiDeclaration)});if(Object.keys(apiDeclaration.models).length){extend(models,transformAllModels(apiDeclaration.models))}});if(Object.keys(models).length){result.definitions=transformAllModels(models)}return result}function buildInfo(source){var info={version:source.apiVersion,title:"Title was not specified"};if(typeof source.info==="object"){if(source.info.title){info.title=source.info.title}if(source.info.description){info.description=source.info.description}if(source.info.contact){info.contact={email:source.info.contact}}if(source.info.license){info.license={name:source.info.license,url:source.info.licenseUrl}}if(source.info.termsOfServiceUrl){info.termsOfService=source.info.termsOfServiceUrl}}return info}function assignPathComponents(basePath,result){var url=urlParse(basePath);result.host=url.host;result.basePath=url.path;if(url.protocol){result.schemes=[url.protocol.substr(0,url.protocol.length-1)]}}function processDataType(field){field=clone(field);if(field.$ref&&field.$ref.indexOf("#/definitions/")===-1){field.$ref="#/definitions/"+field.$ref}else if(field.items&&field.items.$ref&&field.items.$ref.indexOf("#/definitions/")===-1){field.items.$ref="#/definitions/"+field.items.$ref}if(field.type==="integer"){if(field.minimum){field.minimum=parseInt(field.minimum,10)}if(field.maximum){field.maximum=parseInt(field.maximum,10)}}else{if(field.minimum){field.minimum=parseFloat(field.minimum)}if(field.maximum){field.maximum=parseFloat(field.maximum)}}if(field.defaultValue){if(field.type==="integer"){field.default=parseInt(field.defaultValue,10)}else if(field.type==="number"){field.default=parseFloat(field.defaultValue)}else{field.default=field.defaultValue}delete field.defaultValue}return field}function buildPath(api,apiDeclaration){var path={};api.operations.forEach(function(oldOperation){var method=oldOperation.method.toLowerCase();path[method]=buildOperation(oldOperation,apiDeclaration.produces,apiDeclaration.consumes)});return path}function buildOperation(oldOperation,produces,consumes){var operation={responses:{},description:oldOperation.description||""};if(oldOperation.summary){operation.summary=oldOperation.summary}if(oldOperation.nickname){operation.operationId=oldOperation.nickname}if(produces){operation.produces=produces}if(consumes){operation.consumes=consumes}if(Array.isArray(oldOperation.parameters)&&oldOperation.parameters.length){operation.parameters=oldOperation.parameters.map(function(parameter){return buildParameter(processDataType(parameter))})}if(Array.isArray(oldOperation.responseMessages)){oldOperation.responseMessages.forEach(function(oldResponse){operation.responses[oldResponse.code]=buildResponse(oldResponse)})}if(!Object.keys(operation.responses).length){operation.responses={200:{description:"No response was specified"}}}return operation}function buildResponse(oldResponse){var response={};response.description=oldResponse.message;return response}function buildParameter(oldParameter){var parameter={"in":oldParameter.paramType,description:oldParameter.description,name:oldParameter.name,required:!!oldParameter.required};var primitiveTypes=["string","number","boolean","integer","array","void","File"];var copyProperties=["default","maximum","minimum","items"];if(primitiveTypes.indexOf(oldParameter.type)===-1){parameter.schema={$ref:"#/definitions/"+oldParameter.type}}else{parameter.type=oldParameter.type.toLowerCase();copyProperties.forEach(function(name){if(typeof oldParameter[name]!=="undefined"){parameter[name]=oldParameter[name]}});if(typeof oldParameter.defaultValue!=="undefined"){parameter.default=oldParameter.defaultValue}}if(parameter.in==="form"){parameter.in="formData"}return parameter}function buildSecurityDefinitions(resourceListing,convertedSecurityNames){var securityDefinitions={};Object.keys(resourceListing.authorizations).forEach(function(name){var authorization=resourceListing.authorizations[name];var createDefinition=function createDefinition(oName){var securityDefinition=securityDefinitions[oName||name]={type:authorization.type};if(authorization.passAs){securityDefinition.in=authorization.passAs}if(authorization.keyname){securityDefinition.name=authorization.keyname}return securityDefinition};if(authorization.grantTypes){convertedSecurityNames[name]=[];Object.keys(authorization.grantTypes).forEach(function(gtName){var grantType=authorization.grantTypes[gtName];var oName=name+"_"+gtName;var securityDefinition=createDefinition(oName);convertedSecurityNames[name].push(oName);if(gtName==="implicit"){securityDefinition.flow="implicit"}else{securityDefinition.flow="accessCode"}switch(gtName){case"implicit":securityDefinition.authorizationUrl=grantType.loginEndpoint.url;break;case"authorization_code":securityDefinition.authorizationUrl=grantType.tokenRequestEndpoint.url;securityDefinition.tokenUrl=grantType.tokenEndpoint.url;break}if(authorization.scopes){securityDefinition.scopes={};authorization.scopes.forEach(function(scope){securityDefinition.scopes[scope.scope]=scope.description||"Undescribed "+scope.scope})}})}else{createDefinition()}});return securityDefinitions}function transformModel(model){if(typeof model.properties==="object"){Object.keys(model.properties).forEach(function(propertieName){model.properties[propertieName]=processDataType(model.properties[propertieName])})}}function transformAllModels(models){var modelsClone=clone(models);if(typeof models!=="object"){throw new Error("models must be object")}var hierarchy={};Object.keys(modelsClone).forEach(function(modelId){var model=modelsClone[modelId];delete model["id"];transformModel(model);if(model.subTypes){hierarchy[modelId]=model.subTypes;delete model.subTypes}});Object.keys(hierarchy).forEach(function(parent){hierarchy[parent].forEach(function(childId){var childModel=modelsClone[childId];if(childModel){var allOf=(childModel.allOf||[]).concat({$ref:"#/definitions/"+parent}).concat(clone(childModel));for(var member in childModel){delete childModel[member]}childModel.allOf=allOf}})});return modelsClone}function extend(source,distention){if(typeof source!=="object"){throw new Error("source must be objects")}if(typeof distention==="object"){Object.keys(distention).forEach(function(key){source[key]=distention[key]})}}},{"lodash.clonedeep":7,url:6}],2:[function(require,module,exports){(function(global){(function(root){var freeExports=typeof exports=="object"&&exports;var freeModule=typeof module=="object"&&module&&module.exports==freeExports&&module;var freeGlobal=typeof global=="object"&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal){root=freeGlobal}var punycode,maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexPunycode=/^xn--/,regexNonASCII=/[^ -~]/,regexSeparators=/\x2E|\u3002|\uFF0E|\uFF61/g,errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode,key;function error(type){throw RangeError(errors[type])}function map(array,fn){var length=array.length;while(length--){array[length]=fn(array[length])}return array}function mapDomain(string,fn){return map(string.split(regexSeparators),fn).join(".")}function ucs2decode(string){var output=[],counter=0,length=string.length,value,extra;while(counter<length){value=string.charCodeAt(counter++);if(value>=55296&&value<=56319&&counter<length){extra=string.charCodeAt(counter++);if((extra&64512)==56320){output.push(((value&1023)<<10)+(extra&1023)+65536)}else{output.push(value);counter--}}else{output.push(value)}}return output}function ucs2encode(array){return map(array,function(value){var output="";if(value>65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value);return output}).join("")}function basicToDigit(codePoint){if(codePoint-48<10){return codePoint-22}if(codePoint-65<26){return codePoint-65}if(codePoint-97<26){return codePoint-97}return base}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((flag!=0)<<5)}function adapt(delta,numPoints,firstTime){var k=0;delta=firstTime?floor(delta/damp):delta>>1;delta+=floor(delta/numPoints);for(;delta>baseMinusTMin*tMax>>1;k+=base){delta=floor(delta/baseMinusTMin)}return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var output=[],inputLength=input.length,out,i=0,n=initialN,bias=initialBias,basic,j,index,oldi,w,k,digit,t,baseMinusT;basic=input.lastIndexOf(delimiter);if(basic<0){basic=0}for(j=0;j<basic;++j){if(input.charCodeAt(j)>=128){error("not-basic")}output.push(input.charCodeAt(j))}for(index=basic>0?basic+1:0;index<inputLength;){for(oldi=i,w=1,k=base;;k+=base){if(index>=inputLength){error("invalid-input")}digit=basicToDigit(input.charCodeAt(index++));if(digit>=base||digit>floor((maxInt-i)/w)){error("overflow")}i+=digit*w;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(digit<t){break}baseMinusT=base-t;if(w>floor(maxInt/baseMinusT)){error("overflow")}w*=baseMinusT}out=output.length+1;bias=adapt(i-oldi,out,oldi==0);if(floor(i/out)>maxInt-n){error("overflow")}n+=floor(i/out);i%=out;output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,output=[],inputLength,handledCPCountPlusOne,baseMinusT,qMinusT;input=ucs2decode(input);inputLength=input.length;n=initialN;delta=0;bias=initialBias;for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<128){output.push(stringFromCharCode(currentValue))}}handledCPCount=basicLength=output.length;if(basicLength){output.push(delimiter)}while(handledCPCount<inputLength){for(m=maxInt,j=0;j<inputLength;++j){currentValue=input[j];if(currentValue>=n&¤tValue<m){m=currentValue}}handledCPCountPlusOne=handledCPCount+1;if(m-n>floor((maxInt-delta)/handledCPCountPlusOne)){error("overflow")}delta+=(m-n)*handledCPCountPlusOne;n=m;for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<n&&++delta>maxInt){error("overflow")}if(currentValue==n){for(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(q<t){break}qMinusT=q-t;baseMinusT=base-t;output.push(stringFromCharCode(digitToBasic(t+qMinusT%baseMinusT,0)));q=floor(qMinusT/baseMinusT)}output.push(stringFromCharCode(digitToBasic(q,0)));bias=adapt(delta,handledCPCountPlusOne,handledCPCount==basicLength);delta=0;++handledCPCount}}++delta;++n}return output.join("")}function toUnicode(domain){return mapDomain(domain,function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string})}function toASCII(domain){return mapDomain(domain,function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string})}punycode={version:"1.2.4",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:toASCII,toUnicode:toUnicode};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define("punycode",function(){return punycode})}else if(freeExports&&!freeExports.nodeType){if(freeModule){freeModule.exports=punycode}else{for(key in punycode){punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key])}}}else{root.punycode=punycode}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],3:[function(require,module,exports){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&";eq=eq||"=";var obj={};if(typeof qs!=="string"||qs.length===0){return obj}var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;if(options&&typeof options.maxKeys==="number"){maxKeys=options.maxKeys}var len=qs.length;if(maxKeys>0&&len>maxKeys){len=maxKeys}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,"%20"),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1)}else{kstr=x;vstr=""}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v}else if(isArray(obj[k])){obj[k].push(v)}else{obj[k]=[obj[k],v]}}return obj};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"}},{}],4:[function(require,module,exports){"use strict";var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){sep=sep||"&";eq=eq||"=";if(obj===null){obj=undefined}if(typeof obj==="object"){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep)}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]))}}).join(sep)}if(!name)return"";return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj))};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i))}return res}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key)}return res}},{}],5:[function(require,module,exports){"use strict";exports.decode=exports.parse=require("./decode");exports.encode=exports.stringify=require("./encode")},{"./decode":3,"./encode":4}],6:[function(require,module,exports){var punycode=require("punycode");exports.parse=urlParse;exports.resolve=urlResolve;exports.resolveObject=urlResolveObject;exports.format=urlFormat;exports.Url=Url;function Url(){this.protocol=null;this.slashes=null;this.auth=null;this.host=null;this.port=null;this.hostname=null;this.hash=null;this.search=null;this.query=null;this.pathname=null;this.path=null;this.href=null}var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,delims=["<",">",'"',"`"," ","\r","\n"," "],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:true,"javascript:":true},hostlessProtocol={javascript:true,"javascript:":true},slashedProtocol={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"https:":true,"ftp:":true,"gopher:":true,"file:":true},querystring=require("querystring");function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&isObject(url)&&url instanceof Url)return url;var u=new Url;u.parse(url,parseQueryString,slashesDenoteHost);return u}Url.prototype.parse=function(url,parseQueryString,slashesDenoteHost){if(!isString(url)){throw new TypeError("Parameter 'url' must be a string, not "+typeof url)}var rest=url;rest=rest.trim();var proto=protocolPattern.exec(rest);if(proto){proto=proto[0];var lowerProto=proto.toLowerCase();this.protocol=lowerProto;rest=rest.substr(proto.length)}if(slashesDenoteHost||proto||rest.match(/^\/\/[^@\/]+@[^@\/]+/)){var slashes=rest.substr(0,2)==="//";if(slashes&&!(proto&&hostlessProtocol[proto])){rest=rest.substr(2);this.slashes=true}}if(!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){var hostEnd=-1;for(var i=0;i<hostEndingChars.length;i++){var hec=rest.indexOf(hostEndingChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec}var auth,atSign;if(hostEnd===-1){atSign=rest.lastIndexOf("@")}else{atSign=rest.lastIndexOf("@",hostEnd)}if(atSign!==-1){auth=rest.slice(0,atSign);rest=rest.slice(atSign+1);this.auth=decodeURIComponent(auth)}hostEnd=-1;for(var i=0;i<nonHostChars.length;i++){var hec=rest.indexOf(nonHostChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec}if(hostEnd===-1)hostEnd=rest.length;this.host=rest.slice(0,hostEnd);rest=rest.slice(hostEnd);this.parseHost();this.hostname=this.hostname||"";var ipv6Hostname=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!ipv6Hostname){var hostparts=this.hostname.split(/\./);for(var i=0,l=hostparts.length;i<l;i++){var part=hostparts[i];if(!part)continue;if(!part.match(hostnamePartPattern)){var newpart="";for(var j=0,k=part.length;j<k;j++){if(part.charCodeAt(j)>127){newpart+="x"}else{newpart+=part[j]}}if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i);var notHost=hostparts.slice(i+1);var bit=part.match(hostnamePartStart);if(bit){validParts.push(bit[1]);notHost.unshift(bit[2])}if(notHost.length){rest="/"+notHost.join(".")+rest}this.hostname=validParts.join(".");break}}}}if(this.hostname.length>hostnameMaxLen){this.hostname=""}else{this.hostname=this.hostname.toLowerCase()}if(!ipv6Hostname){var domainArray=this.hostname.split(".");var newOut=[];for(var i=0;i<domainArray.length;++i){var s=domainArray[i];newOut.push(s.match(/[^A-Za-z0-9_-]/)?"xn--"+punycode.encode(s):s)}this.hostname=newOut.join(".")}var p=this.port?":"+this.port:"";var h=this.hostname||"";this.host=h+p;this.href+=this.host;if(ipv6Hostname){this.hostname=this.hostname.substr(1,this.hostname.length-2);if(rest[0]!=="/"){rest="/"+rest}}}if(!unsafeProtocol[lowerProto]){for(var i=0,l=autoEscape.length;i<l;i++){var ae=autoEscape[i];var esc=encodeURIComponent(ae);if(esc===ae){esc=escape(ae)}rest=rest.split(ae).join(esc)}}var hash=rest.indexOf("#");if(hash!==-1){this.hash=rest.substr(hash);rest=rest.slice(0,hash)}var qm=rest.indexOf("?");if(qm!==-1){this.search=rest.substr(qm);this.query=rest.substr(qm+1);if(parseQueryString){this.query=querystring.parse(this.query)}rest=rest.slice(0,qm)}else if(parseQueryString){this.search="";this.query={}}if(rest)this.pathname=rest;if(slashedProtocol[lowerProto]&&this.hostname&&!this.pathname){this.pathname="/"}if(this.pathname||this.search){var p=this.pathname||"";var s=this.search||"";this.path=p+s}this.href=this.format();return this};function urlFormat(obj){if(isString(obj))obj=urlParse(obj);if(!(obj instanceof Url))return Url.prototype.format.call(obj);return obj.format()}Url.prototype.format=function(){var auth=this.auth||"";if(auth){auth=encodeURIComponent(auth);auth=auth.replace(/%3A/i,":");auth+="@"}var protocol=this.protocol||"",pathname=this.pathname||"",hash=this.hash||"",host=false,query="";if(this.host){host=auth+this.host}else if(this.hostname){host=auth+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]");if(this.port){host+=":"+this.port}}if(this.query&&isObject(this.query)&&Object.keys(this.query).length){query=querystring.stringify(this.query)}var search=this.search||query&&"?"+query||"";if(protocol&&protocol.substr(-1)!==":")protocol+=":";if(this.slashes||(!protocol||slashedProtocol[protocol])&&host!==false){host="//"+(host||"");if(pathname&&pathname.charAt(0)!=="/")pathname="/"+pathname}else if(!host){host=""}if(hash&&hash.charAt(0)!=="#")hash="#"+hash;if(search&&search.charAt(0)!=="?")search="?"+search;pathname=pathname.replace(/[?#]/g,function(match){return encodeURIComponent(match)});search=search.replace("#","%23");return protocol+host+pathname+search+hash};function urlResolve(source,relative){return urlParse(source,false,true).resolve(relative)}Url.prototype.resolve=function(relative){return this.resolveObject(urlParse(relative,false,true)).format()};function urlResolveObject(source,relative){if(!source)return relative;return urlParse(source,false,true).resolveObject(relative)}Url.prototype.resolveObject=function(relative){if(isString(relative)){var rel=new Url;rel.parse(relative,false,true);relative=rel}var result=new Url;Object.keys(this).forEach(function(k){result[k]=this[k]},this);result.hash=relative.hash;if(relative.href===""){result.href=result.format();return result}if(relative.slashes&&!relative.protocol){Object.keys(relative).forEach(function(k){if(k!=="protocol")result[k]=relative[k]});if(slashedProtocol[result.protocol]&&result.hostname&&!result.pathname){result.path=result.pathname="/"}result.href=result.format();return result}if(relative.protocol&&relative.protocol!==result.protocol){if(!slashedProtocol[relative.protocol]){Object.keys(relative).forEach(function(k){result[k]=relative[k]});result.href=result.format();return result}result.protocol=relative.protocol;if(!relative.host&&!hostlessProtocol[relative.protocol]){var relPath=(relative.pathname||"").split("/");while(relPath.length&&!(relative.host=relPath.shift()));if(!relative.host)relative.host="";if(!relative.hostname)relative.hostname="";if(relPath[0]!=="")relPath.unshift("");if(relPath.length<2)relPath.unshift("");result.pathname=relPath.join("/")}else{result.pathname=relative.pathname}result.search=relative.search;result.query=relative.query;result.host=relative.host||"";result.auth=relative.auth;result.hostname=relative.hostname||relative.host;result.port=relative.port;if(result.pathname||result.search){var p=result.pathname||"";var s=result.search||"";result.path=p+s}result.slashes=result.slashes||relative.slashes;result.href=result.format();return result}var isSourceAbs=result.pathname&&result.pathname.charAt(0)==="/",isRelAbs=relative.host||relative.pathname&&relative.pathname.charAt(0)==="/",mustEndAbs=isRelAbs||isSourceAbs||result.host&&relative.pathname,removeAllDots=mustEndAbs,srcPath=result.pathname&&result.pathname.split("/")||[],relPath=relative.pathname&&relative.pathname.split("/")||[],psychotic=result.protocol&&!slashedProtocol[result.protocol];if(psychotic){result.hostname="";result.port=null;if(result.host){if(srcPath[0]==="")srcPath[0]=result.host;else srcPath.unshift(result.host)}result.host="";if(relative.protocol){relative.hostname=null;relative.port=null;if(relative.host){if(relPath[0]==="")relPath[0]=relative.host;else relPath.unshift(relative.host)}relative.host=null}mustEndAbs=mustEndAbs&&(relPath[0]===""||srcPath[0]==="")}if(isRelAbs){result.host=relative.host||relative.host===""?relative.host:result.host;result.hostname=relative.hostname||relative.hostname===""?relative.hostname:result.hostname;result.search=relative.search;result.query=relative.query;srcPath=relPath}else if(relPath.length){if(!srcPath)srcPath=[];srcPath.pop();srcPath=srcPath.concat(relPath);result.search=relative.search;result.query=relative.query}else if(!isNullOrUndefined(relative.search)){if(psychotic){result.hostname=result.host=srcPath.shift();var authInHost=result.host&&result.host.indexOf("@")>0?result.host.split("@"):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift()}}result.search=relative.search;result.query=relative.query;if(!isNull(result.pathname)||!isNull(result.search)){result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")}result.href=result.format();return result}if(!srcPath.length){result.pathname=null;if(result.search){result.path="/"+result.search}else{result.path=null}result.href=result.format();return result}var last=srcPath.slice(-1)[0];var hasTrailingSlash=(result.host||relative.host)&&(last==="."||last==="..")||last==="";var up=0;for(var i=srcPath.length;i>=0;i--){last=srcPath[i];if(last=="."){srcPath.splice(i,1)}else if(last===".."){srcPath.splice(i,1);up++}else if(up){srcPath.splice(i,1);up--}}if(!mustEndAbs&&!removeAllDots){for(;up--;up){srcPath.unshift("..")}}if(mustEndAbs&&srcPath[0]!==""&&(!srcPath[0]||srcPath[0].charAt(0)!=="/")){srcPath.unshift("")}if(hasTrailingSlash&&srcPath.join("/").substr(-1)!=="/"){srcPath.push("")}var isAbsolute=srcPath[0]===""||srcPath[0]&&srcPath[0].charAt(0)==="/";if(psychotic){result.hostname=result.host=isAbsolute?"":srcPath.length?srcPath.shift():"";var authInHost=result.host&&result.host.indexOf("@")>0?result.host.split("@"):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift()}}mustEndAbs=mustEndAbs||result.host&&srcPath.length;if(mustEndAbs&&!isAbsolute){srcPath.unshift("")}if(!srcPath.length){result.pathname=null;result.path=null}else{result.pathname=srcPath.join("/")}if(!isNull(result.pathname)||!isNull(result.search)){result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==":"){this.port=port.substr(1)}host=host.substr(0,host.length-port.length)}if(host)this.hostname=host};function isString(arg){return typeof arg==="string"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isNull(arg){return arg===null}function isNullOrUndefined(arg){return arg==null}},{punycode:2,querystring:5}],7:[function(require,module,exports){var baseClone=require("lodash._baseclone"),baseCreateCallback=require("lodash._basecreatecallback");function cloneDeep(value,callback,thisArg){return baseClone(value,true,typeof callback=="function"&&baseCreateCallback(callback,thisArg,1))}module.exports=cloneDeep},{"lodash._baseclone":8,"lodash._basecreatecallback":30}],8:[function(require,module,exports){var assign=require("lodash.assign"),forEach=require("lodash.foreach"),forOwn=require("lodash.forown"),getArray=require("lodash._getarray"),isArray=require("lodash.isarray"),isObject=require("lodash.isobject"),releaseArray=require("lodash._releasearray"),slice=require("lodash._slice");var reFlags=/\w*$/;var argsClass="[object Arguments]",arrayClass="[object Array]",boolClass="[object Boolean]",dateClass="[object Date]",funcClass="[object Function]",numberClass="[object Number]",objectClass="[object Object]",regexpClass="[object RegExp]",stringClass="[object String]";var cloneableClasses={};cloneableClasses[funcClass]=false;cloneableClasses[argsClass]=cloneableClasses[arrayClass]=cloneableClasses[boolClass]=cloneableClasses[dateClass]=cloneableClasses[numberClass]=cloneableClasses[objectClass]=cloneableClasses[regexpClass]=cloneableClasses[stringClass]=true;var objectProto=Object.prototype;var toString=objectProto.toString;var hasOwnProperty=objectProto.hasOwnProperty;var ctorByClass={};ctorByClass[arrayClass]=Array;ctorByClass[boolClass]=Boolean;ctorByClass[dateClass]=Date;ctorByClass[funcClass]=Function;ctorByClass[objectClass]=Object;ctorByClass[numberClass]=Number;ctorByClass[regexpClass]=RegExp;ctorByClass[stringClass]=String;function baseClone(value,isDeep,callback,stackA,stackB){if(callback){var result=callback(value);if(typeof result!="undefined"){return result}}var isObj=isObject(value);if(isObj){var className=toString.call(value);if(!cloneableClasses[className]){return value}var ctor=ctorByClass[className];switch(className){case boolClass:case dateClass:return new ctor(+value);case numberClass:case stringClass:return new ctor(value);case regexpClass:result=ctor(value.source,reFlags.exec(value));result.lastIndex=value.lastIndex;return result}}else{return value}var isArr=isArray(value);if(isDeep){var initedStack=!stackA;stackA||(stackA=getArray());stackB||(stackB=getArray());var length=stackA.length;while(length--){if(stackA[length]==value){return stackB[length]}}result=isArr?ctor(value.length):{}}else{result=isArr?slice(value):assign({},value)}if(isArr){if(hasOwnProperty.call(value,"index")){result.index=value.index}if(hasOwnProperty.call(value,"input")){result.input=value.input}}if(!isDeep){return result}stackA.push(value);stackB.push(result);(isArr?forEach:forOwn)(value,function(objValue,key){result[key]=baseClone(objValue,isDeep,callback,stackA,stackB)});if(initedStack){releaseArray(stackA);releaseArray(stackB)}return result}module.exports=baseClone},{"lodash._getarray":9,"lodash._releasearray":11,"lodash._slice":14,"lodash.assign":15,"lodash.foreach":20,"lodash.forown":21,"lodash.isarray":26,"lodash.isobject":28}],9:[function(require,module,exports){var arrayPool=require("lodash._arraypool");function getArray(){return arrayPool.pop()||[]}module.exports=getArray},{"lodash._arraypool":10}],10:[function(require,module,exports){var arrayPool=[];module.exports=arrayPool},{}],11:[function(require,module,exports){var arrayPool=require("lodash._arraypool"),maxPoolSize=require("lodash._maxpoolsize");function releaseArray(array){array.length=0;if(arrayPool.length<maxPoolSize){arrayPool.push(array)}}module.exports=releaseArray},{"lodash._arraypool":12,"lodash._maxpoolsize":13}],12:[function(require,module,exports){module.exports=require(10)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash._getarray/node_modules/lodash._arraypool/index.js":10}],13:[function(require,module,exports){var maxPoolSize=40;module.exports=maxPoolSize},{}],14:[function(require,module,exports){function slice(array,start,end){start||(start=0);if(typeof end=="undefined"){end=array?array.length:0}var index=-1,length=end-start||0,result=Array(length<0?0:length);while(++index<length){result[index]=array[start+index]}return result}module.exports=slice},{}],15:[function(require,module,exports){var baseCreateCallback=require("lodash._basecreatecallback"),keys=require("lodash.keys"),objectTypes=require("lodash._objecttypes");var assign=function(object,source,guard){var index,iterable=object,result=iterable;if(!iterable)return result;var args=arguments,argsIndex=0,argsLength=typeof guard=="number"?2:args.length;if(argsLength>3&&typeof args[argsLength-2]=="function"){var callback=baseCreateCallback(args[--argsLength-1],args[argsLength--],2)}else if(argsLength>2&&typeof args[argsLength-1]=="function"){callback=args[--argsLength]}while(++argsIndex<argsLength){iterable=args[argsIndex];if(iterable&&objectTypes[typeof iterable]){var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];result[index]=callback?callback(result[index],iterable[index]):iterable[index]}}}return result};module.exports=assign},{"lodash._basecreatecallback":30,"lodash._objecttypes":16,"lodash.keys":17}],16:[function(require,module,exports){var objectTypes={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false};module.exports=objectTypes},{}],17:[function(require,module,exports){var isNative=require("lodash._isnative"),isObject=require("lodash.isobject"),shimKeys=require("lodash._shimkeys"); | ||
var nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys;var keys=!nativeKeys?shimKeys:function(object){if(!isObject(object)){return[]}return nativeKeys(object)};module.exports=keys},{"lodash._isnative":18,"lodash._shimkeys":19,"lodash.isobject":28}],18:[function(require,module,exports){var objectProto=Object.prototype;var toString=objectProto.toString;var reNative=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");function isNative(value){return typeof value=="function"&&reNative.test(value)}module.exports=isNative},{}],19:[function(require,module,exports){var objectTypes=require("lodash._objecttypes");var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;var shimKeys=function(object){var index,iterable=object,result=[];if(!iterable)return result;if(!objectTypes[typeof object])return result;for(index in iterable){if(hasOwnProperty.call(iterable,index)){result.push(index)}}return result};module.exports=shimKeys},{"lodash._objecttypes":16}],20:[function(require,module,exports){var baseCreateCallback=require("lodash._basecreatecallback"),forOwn=require("lodash.forown");function forEach(collection,callback,thisArg){var index=-1,length=collection?collection.length:0;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);if(typeof length=="number"){while(++index<length){if(callback(collection[index],index,collection)===false){break}}}else{forOwn(collection,callback)}return collection}module.exports=forEach},{"lodash._basecreatecallback":30,"lodash.forown":21}],21:[function(require,module,exports){var baseCreateCallback=require("lodash._basecreatecallback"),keys=require("lodash.keys"),objectTypes=require("lodash._objecttypes");var forOwn=function(collection,callback,thisArg){var index,iterable=collection,result=iterable;if(!iterable)return result;if(!objectTypes[typeof iterable])return result;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];if(callback(iterable[index],index,collection)===false)return result}return result};module.exports=forOwn},{"lodash._basecreatecallback":30,"lodash._objecttypes":22,"lodash.keys":23}],22:[function(require,module,exports){module.exports=require(16)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash._objecttypes/index.js":16}],23:[function(require,module,exports){module.exports=require(17)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/index.js":17,"lodash._isnative":24,"lodash._shimkeys":25,"lodash.isobject":28}],24:[function(require,module,exports){module.exports=require(18)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._isnative/index.js":18}],25:[function(require,module,exports){module.exports=require(19)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._shimkeys/index.js":19,"lodash._objecttypes":22}],26:[function(require,module,exports){var isNative=require("lodash._isnative");var arrayClass="[object Array]";var objectProto=Object.prototype;var toString=objectProto.toString;var nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray;var isArray=nativeIsArray||function(value){return value&&typeof value=="object"&&typeof value.length=="number"&&toString.call(value)==arrayClass||false};module.exports=isArray},{"lodash._isnative":27}],27:[function(require,module,exports){module.exports=require(18)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._isnative/index.js":18}],28:[function(require,module,exports){var objectTypes=require("lodash._objecttypes");function isObject(value){return!!(value&&objectTypes[typeof value])}module.exports=isObject},{"lodash._objecttypes":29}],29:[function(require,module,exports){module.exports=require(16)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash._objecttypes/index.js":16}],30:[function(require,module,exports){var bind=require("lodash.bind"),identity=require("lodash.identity"),setBindData=require("lodash._setbinddata"),support=require("lodash.support");var reFuncName=/^\s*function[ \n\r\t]+\w/;var reThis=/\bthis\b/;var fnToString=Function.prototype.toString;function baseCreateCallback(func,thisArg,argCount){if(typeof func!="function"){return identity}if(typeof thisArg=="undefined"||!("prototype"in func)){return func}var bindData=func.__bindData__;if(typeof bindData=="undefined"){if(support.funcNames){bindData=!func.name}bindData=bindData||!support.funcDecomp;if(!bindData){var source=fnToString.call(func);if(!support.funcNames){bindData=!reFuncName.test(source)}if(!bindData){bindData=reThis.test(source);setBindData(func,bindData)}}}if(bindData===false||bindData!==true&&bindData[1]&1){return func}switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 2:return function(a,b){return func.call(thisArg,a,b)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)}}return bind(func,thisArg)}module.exports=baseCreateCallback},{"lodash._setbinddata":31,"lodash.bind":34,"lodash.identity":50,"lodash.support":51}],31:[function(require,module,exports){var isNative=require("lodash._isnative"),noop=require("lodash.noop");var descriptor={configurable:false,enumerable:false,value:null,writable:false};var defineProperty=function(){try{var o={},func=isNative(func=Object.defineProperty)&&func,result=func(o,o,o)&&func}catch(e){}return result}();var setBindData=!defineProperty?noop:function(func,value){descriptor.value=value;defineProperty(func,"__bindData__",descriptor)};module.exports=setBindData},{"lodash._isnative":32,"lodash.noop":33}],32:[function(require,module,exports){module.exports=require(18)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._isnative/index.js":18}],33:[function(require,module,exports){function noop(){}module.exports=noop},{}],34:[function(require,module,exports){var createWrapper=require("lodash._createwrapper"),slice=require("lodash._slice");function bind(func,thisArg){return arguments.length>2?createWrapper(func,17,slice(arguments,2),null,thisArg):createWrapper(func,1,null,null,thisArg)}module.exports=bind},{"lodash._createwrapper":35,"lodash._slice":49}],35:[function(require,module,exports){var baseBind=require("lodash._basebind"),baseCreateWrapper=require("lodash._basecreatewrapper"),isFunction=require("lodash.isfunction"),slice=require("lodash._slice");var arrayRef=[];var push=arrayRef.push,unshift=arrayRef.unshift;function createWrapper(func,bitmask,partialArgs,partialRightArgs,thisArg,arity){var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,isPartial=bitmask&16,isPartialRight=bitmask&32;if(!isBindKey&&!isFunction(func)){throw new TypeError}if(isPartial&&!partialArgs.length){bitmask&=~16;isPartial=partialArgs=false}if(isPartialRight&&!partialRightArgs.length){bitmask&=~32;isPartialRight=partialRightArgs=false}var bindData=func&&func.__bindData__;if(bindData&&bindData!==true){bindData=slice(bindData);if(bindData[2]){bindData[2]=slice(bindData[2])}if(bindData[3]){bindData[3]=slice(bindData[3])}if(isBind&&!(bindData[1]&1)){bindData[4]=thisArg}if(!isBind&&bindData[1]&1){bitmask|=8}if(isCurry&&!(bindData[1]&4)){bindData[5]=arity}if(isPartial){push.apply(bindData[2]||(bindData[2]=[]),partialArgs)}if(isPartialRight){unshift.apply(bindData[3]||(bindData[3]=[]),partialRightArgs)}bindData[1]|=bitmask;return createWrapper.apply(null,bindData)}var creater=bitmask==1||bitmask===17?baseBind:baseCreateWrapper;return creater([func,bitmask,partialArgs,partialRightArgs,thisArg,arity])}module.exports=createWrapper},{"lodash._basebind":36,"lodash._basecreatewrapper":42,"lodash._slice":49,"lodash.isfunction":48}],36:[function(require,module,exports){var baseCreate=require("lodash._basecreate"),isObject=require("lodash.isobject"),setBindData=require("lodash._setbinddata"),slice=require("lodash._slice");var arrayRef=[];var push=arrayRef.push;function baseBind(bindData){var func=bindData[0],partialArgs=bindData[2],thisArg=bindData[4];function bound(){if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(this instanceof bound){var thisBinding=baseCreate(func.prototype),result=func.apply(thisBinding,args||arguments);return isObject(result)?result:thisBinding}return func.apply(thisArg,args||arguments)}setBindData(bound,bindData);return bound}module.exports=baseBind},{"lodash._basecreate":37,"lodash._setbinddata":31,"lodash._slice":49,"lodash.isobject":40}],37:[function(require,module,exports){(function(global){var isNative=require("lodash._isnative"),isObject=require("lodash.isobject"),noop=require("lodash.noop");var nativeCreate=isNative(nativeCreate=Object.create)&&nativeCreate;function baseCreate(prototype,properties){return isObject(prototype)?nativeCreate(prototype):{}}if(!nativeCreate){baseCreate=function(){function Object(){}return function(prototype){if(isObject(prototype)){Object.prototype=prototype;var result=new Object;Object.prototype=null}return result||global.Object()}}()}module.exports=baseCreate}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"lodash._isnative":38,"lodash.isobject":40,"lodash.noop":39}],38:[function(require,module,exports){module.exports=require(18)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._isnative/index.js":18}],39:[function(require,module,exports){module.exports=require(33)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":33}],40:[function(require,module,exports){module.exports=require(28)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.isobject/index.js":28,"lodash._objecttypes":41}],41:[function(require,module,exports){module.exports=require(16)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash._objecttypes/index.js":16}],42:[function(require,module,exports){var baseCreate=require("lodash._basecreate"),isObject=require("lodash.isobject"),setBindData=require("lodash._setbinddata"),slice=require("lodash._slice");var arrayRef=[];var push=arrayRef.push;function baseCreateWrapper(bindData){var func=bindData[0],bitmask=bindData[1],partialArgs=bindData[2],partialRightArgs=bindData[3],thisArg=bindData[4],arity=bindData[5];var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,key=func;function bound(){var thisBinding=isBind?thisArg:this;if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(partialRightArgs||isCurry){args||(args=slice(arguments));if(partialRightArgs){push.apply(args,partialRightArgs)}if(isCurry&&args.length<arity){bitmask|=16&~32;return baseCreateWrapper([func,isCurryBound?bitmask:bitmask&~3,args,null,thisArg,arity])}}args||(args=arguments);if(isBindKey){func=thisBinding[key]}if(this instanceof bound){thisBinding=baseCreate(func.prototype);var result=func.apply(thisBinding,args);return isObject(result)?result:thisBinding}return func.apply(thisBinding,args)}setBindData(bound,bindData);return bound}module.exports=baseCreateWrapper},{"lodash._basecreate":43,"lodash._setbinddata":31,"lodash._slice":49,"lodash.isobject":46}],43:[function(require,module,exports){module.exports=require(37)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash._basebind/node_modules/lodash._basecreate/index.js":37,"lodash._isnative":44,"lodash.isobject":46,"lodash.noop":45}],44:[function(require,module,exports){module.exports=require(18)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._isnative/index.js":18}],45:[function(require,module,exports){module.exports=require(33)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":33}],46:[function(require,module,exports){module.exports=require(28)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.isobject/index.js":28,"lodash._objecttypes":47}],47:[function(require,module,exports){module.exports=require(16)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash._objecttypes/index.js":16}],48:[function(require,module,exports){function isFunction(value){return typeof value=="function"}module.exports=isFunction},{}],49:[function(require,module,exports){module.exports=require(14)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash._slice/index.js":14}],50:[function(require,module,exports){function identity(value){return value}module.exports=identity},{}],51:[function(require,module,exports){(function(global){var isNative=require("lodash._isnative");var reThis=/\bthis\b/;var support={};support.funcDecomp=!isNative(global.WinRTError)&&reThis.test(function(){return this});support.funcNames=typeof Function.name=="string";module.exports=support}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"lodash._isnative":52}],52:[function(require,module,exports){module.exports=require(18)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._isnative/index.js":18}]},{},[1]); | ||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){var urlParse=require("url").parse;var clone=require("lodash.clonedeep");var primitiveTypes=["string","number","boolean","integer","array","void","File"];if(typeof window==="undefined"){module.exports=convert}else{window.SwaggerConverter=window.SwaggerConverter||{convert:convert}}function convert(resourceListing,apiDeclarations){if(typeof resourceListing!=="object"){throw new Error("resourceListing must be an object")}if(!Array.isArray(apiDeclarations)){apiDeclarations=[]}var convertedSecurityNames={};var models={};var result={swagger:"2.0",info:buildInfo(resourceListing),paths:{}};if(resourceListing.authorizations){result.securityDefinitions=buildSecurityDefinitions(resourceListing,convertedSecurityNames)}if(resourceListing.basePath){assignPathComponents(resourceListing.basePath,result)}extend(models,resourceListing.models);if(Array.isArray(resourceListing.apis)){if(apiDeclarations.length>0){result.tags=[]}resourceListing.apis.forEach(function(api){if(result.tags){result.tags.push({name:api.path.replace(".{format}","").substring(1),description:api.description})}if(Array.isArray(api.operations)){result.paths[api.path]=buildPath(api,resourceListing)}})}apiDeclarations.forEach(function(apiDeclaration){if(apiDeclaration.basePath){assignPathComponents(apiDeclaration.basePath,result)}if(!Array.isArray(apiDeclaration.apis)){return}apiDeclaration.apis.forEach(function(api){result.paths[api.path]=buildPath(api,apiDeclaration)});if(Object.keys(apiDeclaration.models).length){extend(models,transformAllModels(apiDeclaration.models))}});if(Object.keys(models).length){result.definitions=transformAllModels(models)}return result}function buildInfo(source){var info={version:source.apiVersion,title:"Title was not specified"};if(typeof source.info==="object"){if(source.info.title){info.title=source.info.title}if(source.info.description){info.description=source.info.description}if(source.info.contact){info.contact={email:source.info.contact}}if(source.info.license){info.license={name:source.info.license,url:source.info.licenseUrl}}if(source.info.termsOfServiceUrl){info.termsOfService=source.info.termsOfServiceUrl}}return info}function assignPathComponents(basePath,result){var url=urlParse(basePath);result.host=url.host;result.basePath=url.path;if(url.protocol){result.schemes=[url.protocol.substr(0,url.protocol.length-1)]}}function processDataType(field,fixRef){field=clone(field);if(field.$ref&&field.$ref.indexOf("#/definitions/")===-1){field.$ref="#/definitions/"+field.$ref}else if(field.items&&field.items.$ref&&field.items.$ref.indexOf("#/definitions/")===-1){field.items.$ref="#/definitions/"+field.items.$ref}if(fixRef){if(field.type&&primitiveTypes.indexOf(field.type)===-1){field={$ref:"#/definitions/"+field.type}}}if(field.type==="integer"){if(field.minimum){field.minimum=parseInt(field.minimum,10)}if(field.maximum){field.maximum=parseInt(field.maximum,10)}}else{if(field.minimum){field.minimum=parseFloat(field.minimum)}if(field.maximum){field.maximum=parseFloat(field.maximum)}}if(field.defaultValue){if(field.type==="integer"){field.default=parseInt(field.defaultValue,10)}else if(field.type==="number"){field.default=parseFloat(field.defaultValue)}else{field.default=field.defaultValue}delete field.defaultValue}return field}function buildPath(api,apiDeclaration){var path={};api.operations.forEach(function(oldOperation){var method=oldOperation.method.toLowerCase();path[method]=buildOperation(oldOperation,apiDeclaration.produces,apiDeclaration.consumes,apiDeclaration.resourcePath)});return path}function buildOperation(oldOperation,produces,consumes,resourcePath){var operation={responses:{},description:oldOperation.description||""};if(resourcePath){operation.tags=[];operation.tags.push(resourcePath.substr(1))}if(oldOperation.summary){operation.summary=oldOperation.summary}if(oldOperation.nickname){operation.operationId=oldOperation.nickname}if(produces){operation.produces=produces}if(consumes){operation.consumes=consumes}if(Array.isArray(oldOperation.parameters)&&oldOperation.parameters.length){operation.parameters=oldOperation.parameters.map(function(parameter){return buildParameter(processDataType(parameter,false))})}if(Array.isArray(oldOperation.responseMessages)){oldOperation.responseMessages.forEach(function(oldResponse){operation.responses[oldResponse.code]=buildResponse(oldResponse)})}if(oldOperation.type&&oldOperation.type!=="void"&&primitiveTypes.indexOf(oldOperation.type)===-1){operation.responses["default"]={schema:{$ref:"#/definitions/"+oldOperation.type}}}if(!Object.keys(operation.responses).length){operation.responses={200:{description:"No response was specified"}}}return operation}function buildResponse(oldResponse){var response={};response.description=oldResponse.message;return response}function buildParameter(oldParameter){var parameter={"in":oldParameter.paramType,description:oldParameter.description,name:oldParameter.name,required:!!oldParameter.required};var copyProperties=["default","maximum","minimum","items"];if(primitiveTypes.indexOf(oldParameter.type)===-1){parameter.schema={$ref:"#/definitions/"+oldParameter.type}}else{parameter.type=oldParameter.type.toLowerCase();copyProperties.forEach(function(name){if(typeof oldParameter[name]!=="undefined"){parameter[name]=oldParameter[name]}});if(typeof oldParameter.defaultValue!=="undefined"){parameter.default=oldParameter.defaultValue}}if(parameter.in==="form"){parameter.in="formData"}return parameter}function buildSecurityDefinitions(resourceListing,convertedSecurityNames){var securityDefinitions={};Object.keys(resourceListing.authorizations).forEach(function(name){var authorization=resourceListing.authorizations[name];var createDefinition=function createDefinition(oName){var securityDefinition=securityDefinitions[oName||name]={type:authorization.type};if(authorization.passAs){securityDefinition.in=authorization.passAs}if(authorization.keyname){securityDefinition.name=authorization.keyname}return securityDefinition};if(authorization.grantTypes){convertedSecurityNames[name]=[];Object.keys(authorization.grantTypes).forEach(function(gtName){var grantType=authorization.grantTypes[gtName];var oName=name+"_"+gtName;var securityDefinition=createDefinition(oName);convertedSecurityNames[name].push(oName);if(gtName==="implicit"){securityDefinition.flow="implicit"}else{securityDefinition.flow="accessCode"}switch(gtName){case"implicit":securityDefinition.authorizationUrl=grantType.loginEndpoint.url;break;case"authorization_code":securityDefinition.authorizationUrl=grantType.tokenRequestEndpoint.url;securityDefinition.tokenUrl=grantType.tokenEndpoint.url;break}if(authorization.scopes){securityDefinition.scopes={};authorization.scopes.forEach(function(scope){securityDefinition.scopes[scope.scope]=scope.description||"Undescribed "+scope.scope})}})}else{createDefinition()}});return securityDefinitions}function transformModel(model){if(typeof model.properties==="object"){Object.keys(model.properties).forEach(function(propertieName){model.properties[propertieName]=processDataType(model.properties[propertieName],true)})}}function transformAllModels(models){var modelsClone=clone(models);if(typeof models!=="object"){throw new Error("models must be object")}var hierarchy={};Object.keys(modelsClone).forEach(function(modelId){var model=modelsClone[modelId];delete model["id"];transformModel(model);if(model.subTypes){hierarchy[modelId]=model.subTypes;delete model.subTypes}});Object.keys(hierarchy).forEach(function(parent){hierarchy[parent].forEach(function(childId){var childModel=modelsClone[childId];if(childModel){var allOf=(childModel.allOf||[]).concat({$ref:"#/definitions/"+parent}).concat(clone(childModel));for(var member in childModel){delete childModel[member]}childModel.allOf=allOf}})});return modelsClone}function extend(source,distention){if(typeof source!=="object"){throw new Error("source must be objects")}if(typeof distention==="object"){Object.keys(distention).forEach(function(key){source[key]=distention[key]})}}},{"lodash.clonedeep":7,url:6}],2:[function(require,module,exports){(function(global){(function(root){var freeExports=typeof exports=="object"&&exports;var freeModule=typeof module=="object"&&module&&module.exports==freeExports&&module;var freeGlobal=typeof global=="object"&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal){root=freeGlobal}var punycode,maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexPunycode=/^xn--/,regexNonASCII=/[^ -~]/,regexSeparators=/\x2E|\u3002|\uFF0E|\uFF61/g,errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode,key;function error(type){throw RangeError(errors[type])}function map(array,fn){var length=array.length;while(length--){array[length]=fn(array[length])}return array}function mapDomain(string,fn){return map(string.split(regexSeparators),fn).join(".")}function ucs2decode(string){var output=[],counter=0,length=string.length,value,extra;while(counter<length){value=string.charCodeAt(counter++);if(value>=55296&&value<=56319&&counter<length){extra=string.charCodeAt(counter++);if((extra&64512)==56320){output.push(((value&1023)<<10)+(extra&1023)+65536)}else{output.push(value);counter--}}else{output.push(value)}}return output}function ucs2encode(array){return map(array,function(value){var output="";if(value>65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value);return output}).join("")}function basicToDigit(codePoint){if(codePoint-48<10){return codePoint-22}if(codePoint-65<26){return codePoint-65}if(codePoint-97<26){return codePoint-97}return base}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((flag!=0)<<5)}function adapt(delta,numPoints,firstTime){var k=0;delta=firstTime?floor(delta/damp):delta>>1;delta+=floor(delta/numPoints);for(;delta>baseMinusTMin*tMax>>1;k+=base){delta=floor(delta/baseMinusTMin)}return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var output=[],inputLength=input.length,out,i=0,n=initialN,bias=initialBias,basic,j,index,oldi,w,k,digit,t,baseMinusT;basic=input.lastIndexOf(delimiter);if(basic<0){basic=0}for(j=0;j<basic;++j){if(input.charCodeAt(j)>=128){error("not-basic")}output.push(input.charCodeAt(j))}for(index=basic>0?basic+1:0;index<inputLength;){for(oldi=i,w=1,k=base;;k+=base){if(index>=inputLength){error("invalid-input")}digit=basicToDigit(input.charCodeAt(index++));if(digit>=base||digit>floor((maxInt-i)/w)){error("overflow")}i+=digit*w;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(digit<t){break}baseMinusT=base-t;if(w>floor(maxInt/baseMinusT)){error("overflow")}w*=baseMinusT}out=output.length+1;bias=adapt(i-oldi,out,oldi==0);if(floor(i/out)>maxInt-n){error("overflow")}n+=floor(i/out);i%=out;output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,output=[],inputLength,handledCPCountPlusOne,baseMinusT,qMinusT;input=ucs2decode(input);inputLength=input.length;n=initialN;delta=0;bias=initialBias;for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<128){output.push(stringFromCharCode(currentValue))}}handledCPCount=basicLength=output.length;if(basicLength){output.push(delimiter)}while(handledCPCount<inputLength){for(m=maxInt,j=0;j<inputLength;++j){currentValue=input[j];if(currentValue>=n&¤tValue<m){m=currentValue}}handledCPCountPlusOne=handledCPCount+1;if(m-n>floor((maxInt-delta)/handledCPCountPlusOne)){error("overflow")}delta+=(m-n)*handledCPCountPlusOne;n=m;for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<n&&++delta>maxInt){error("overflow")}if(currentValue==n){for(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(q<t){break}qMinusT=q-t;baseMinusT=base-t;output.push(stringFromCharCode(digitToBasic(t+qMinusT%baseMinusT,0)));q=floor(qMinusT/baseMinusT)}output.push(stringFromCharCode(digitToBasic(q,0)));bias=adapt(delta,handledCPCountPlusOne,handledCPCount==basicLength);delta=0;++handledCPCount}}++delta;++n}return output.join("")}function toUnicode(domain){return mapDomain(domain,function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string})}function toASCII(domain){return mapDomain(domain,function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string})}punycode={version:"1.2.4",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:toASCII,toUnicode:toUnicode};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define("punycode",function(){return punycode})}else if(freeExports&&!freeExports.nodeType){if(freeModule){freeModule.exports=punycode}else{for(key in punycode){punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key])}}}else{root.punycode=punycode}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],3:[function(require,module,exports){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&";eq=eq||"=";var obj={};if(typeof qs!=="string"||qs.length===0){return obj}var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;if(options&&typeof options.maxKeys==="number"){maxKeys=options.maxKeys}var len=qs.length;if(maxKeys>0&&len>maxKeys){len=maxKeys}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,"%20"),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1)}else{kstr=x;vstr=""}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v}else if(isArray(obj[k])){obj[k].push(v)}else{obj[k]=[obj[k],v]}}return obj};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"}},{}],4:[function(require,module,exports){"use strict";var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){sep=sep||"&";eq=eq||"=";if(obj===null){obj=undefined}if(typeof obj==="object"){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep)}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]))}}).join(sep)}if(!name)return"";return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj))};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i))}return res}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key)}return res}},{}],5:[function(require,module,exports){"use strict";exports.decode=exports.parse=require("./decode");exports.encode=exports.stringify=require("./encode")},{"./decode":3,"./encode":4}],6:[function(require,module,exports){var punycode=require("punycode");exports.parse=urlParse;exports.resolve=urlResolve;exports.resolveObject=urlResolveObject;exports.format=urlFormat;exports.Url=Url;function Url(){this.protocol=null;this.slashes=null;this.auth=null;this.host=null;this.port=null;this.hostname=null;this.hash=null;this.search=null;this.query=null;this.pathname=null;this.path=null;this.href=null}var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,delims=["<",">",'"',"`"," ","\r","\n"," "],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:true,"javascript:":true},hostlessProtocol={javascript:true,"javascript:":true},slashedProtocol={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"https:":true,"ftp:":true,"gopher:":true,"file:":true},querystring=require("querystring");function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&isObject(url)&&url instanceof Url)return url;var u=new Url;u.parse(url,parseQueryString,slashesDenoteHost);return u}Url.prototype.parse=function(url,parseQueryString,slashesDenoteHost){if(!isString(url)){throw new TypeError("Parameter 'url' must be a string, not "+typeof url)}var rest=url;rest=rest.trim();var proto=protocolPattern.exec(rest);if(proto){proto=proto[0];var lowerProto=proto.toLowerCase();this.protocol=lowerProto;rest=rest.substr(proto.length)}if(slashesDenoteHost||proto||rest.match(/^\/\/[^@\/]+@[^@\/]+/)){var slashes=rest.substr(0,2)==="//";if(slashes&&!(proto&&hostlessProtocol[proto])){rest=rest.substr(2);this.slashes=true}}if(!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){var hostEnd=-1;for(var i=0;i<hostEndingChars.length;i++){var hec=rest.indexOf(hostEndingChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec}var auth,atSign;if(hostEnd===-1){atSign=rest.lastIndexOf("@")}else{atSign=rest.lastIndexOf("@",hostEnd)}if(atSign!==-1){auth=rest.slice(0,atSign);rest=rest.slice(atSign+1);this.auth=decodeURIComponent(auth)}hostEnd=-1;for(var i=0;i<nonHostChars.length;i++){var hec=rest.indexOf(nonHostChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec}if(hostEnd===-1)hostEnd=rest.length;this.host=rest.slice(0,hostEnd);rest=rest.slice(hostEnd);this.parseHost();this.hostname=this.hostname||"";var ipv6Hostname=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!ipv6Hostname){var hostparts=this.hostname.split(/\./);for(var i=0,l=hostparts.length;i<l;i++){var part=hostparts[i];if(!part)continue;if(!part.match(hostnamePartPattern)){var newpart="";for(var j=0,k=part.length;j<k;j++){if(part.charCodeAt(j)>127){newpart+="x"}else{newpart+=part[j]}}if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i);var notHost=hostparts.slice(i+1);var bit=part.match(hostnamePartStart);if(bit){validParts.push(bit[1]);notHost.unshift(bit[2])}if(notHost.length){rest="/"+notHost.join(".")+rest}this.hostname=validParts.join(".");break}}}}if(this.hostname.length>hostnameMaxLen){this.hostname=""}else{this.hostname=this.hostname.toLowerCase()}if(!ipv6Hostname){var domainArray=this.hostname.split(".");var newOut=[];for(var i=0;i<domainArray.length;++i){var s=domainArray[i];newOut.push(s.match(/[^A-Za-z0-9_-]/)?"xn--"+punycode.encode(s):s)}this.hostname=newOut.join(".")}var p=this.port?":"+this.port:"";var h=this.hostname||"";this.host=h+p;this.href+=this.host;if(ipv6Hostname){this.hostname=this.hostname.substr(1,this.hostname.length-2);if(rest[0]!=="/"){rest="/"+rest}}}if(!unsafeProtocol[lowerProto]){for(var i=0,l=autoEscape.length;i<l;i++){var ae=autoEscape[i];var esc=encodeURIComponent(ae);if(esc===ae){esc=escape(ae)}rest=rest.split(ae).join(esc)}}var hash=rest.indexOf("#");if(hash!==-1){this.hash=rest.substr(hash);rest=rest.slice(0,hash)}var qm=rest.indexOf("?");if(qm!==-1){this.search=rest.substr(qm);this.query=rest.substr(qm+1);if(parseQueryString){this.query=querystring.parse(this.query)}rest=rest.slice(0,qm)}else if(parseQueryString){this.search="";this.query={}}if(rest)this.pathname=rest;if(slashedProtocol[lowerProto]&&this.hostname&&!this.pathname){this.pathname="/"}if(this.pathname||this.search){var p=this.pathname||"";var s=this.search||"";this.path=p+s}this.href=this.format();return this};function urlFormat(obj){if(isString(obj))obj=urlParse(obj);if(!(obj instanceof Url))return Url.prototype.format.call(obj);return obj.format()}Url.prototype.format=function(){var auth=this.auth||"";if(auth){auth=encodeURIComponent(auth);auth=auth.replace(/%3A/i,":");auth+="@"}var protocol=this.protocol||"",pathname=this.pathname||"",hash=this.hash||"",host=false,query="";if(this.host){host=auth+this.host}else if(this.hostname){host=auth+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]");if(this.port){host+=":"+this.port}}if(this.query&&isObject(this.query)&&Object.keys(this.query).length){query=querystring.stringify(this.query)}var search=this.search||query&&"?"+query||"";if(protocol&&protocol.substr(-1)!==":")protocol+=":";if(this.slashes||(!protocol||slashedProtocol[protocol])&&host!==false){host="//"+(host||"");if(pathname&&pathname.charAt(0)!=="/")pathname="/"+pathname}else if(!host){host=""}if(hash&&hash.charAt(0)!=="#")hash="#"+hash;if(search&&search.charAt(0)!=="?")search="?"+search;pathname=pathname.replace(/[?#]/g,function(match){return encodeURIComponent(match)});search=search.replace("#","%23");return protocol+host+pathname+search+hash};function urlResolve(source,relative){return urlParse(source,false,true).resolve(relative)}Url.prototype.resolve=function(relative){return this.resolveObject(urlParse(relative,false,true)).format()};function urlResolveObject(source,relative){if(!source)return relative;return urlParse(source,false,true).resolveObject(relative)}Url.prototype.resolveObject=function(relative){if(isString(relative)){var rel=new Url;rel.parse(relative,false,true);relative=rel}var result=new Url;Object.keys(this).forEach(function(k){result[k]=this[k]},this);result.hash=relative.hash;if(relative.href===""){result.href=result.format();return result}if(relative.slashes&&!relative.protocol){Object.keys(relative).forEach(function(k){if(k!=="protocol")result[k]=relative[k]});if(slashedProtocol[result.protocol]&&result.hostname&&!result.pathname){result.path=result.pathname="/"}result.href=result.format();return result}if(relative.protocol&&relative.protocol!==result.protocol){if(!slashedProtocol[relative.protocol]){Object.keys(relative).forEach(function(k){result[k]=relative[k]});result.href=result.format();return result}result.protocol=relative.protocol;if(!relative.host&&!hostlessProtocol[relative.protocol]){var relPath=(relative.pathname||"").split("/");while(relPath.length&&!(relative.host=relPath.shift()));if(!relative.host)relative.host="";if(!relative.hostname)relative.hostname="";if(relPath[0]!=="")relPath.unshift("");if(relPath.length<2)relPath.unshift("");result.pathname=relPath.join("/")}else{result.pathname=relative.pathname}result.search=relative.search;result.query=relative.query;result.host=relative.host||"";result.auth=relative.auth;result.hostname=relative.hostname||relative.host;result.port=relative.port;if(result.pathname||result.search){var p=result.pathname||"";var s=result.search||"";result.path=p+s}result.slashes=result.slashes||relative.slashes;result.href=result.format();return result}var isSourceAbs=result.pathname&&result.pathname.charAt(0)==="/",isRelAbs=relative.host||relative.pathname&&relative.pathname.charAt(0)==="/",mustEndAbs=isRelAbs||isSourceAbs||result.host&&relative.pathname,removeAllDots=mustEndAbs,srcPath=result.pathname&&result.pathname.split("/")||[],relPath=relative.pathname&&relative.pathname.split("/")||[],psychotic=result.protocol&&!slashedProtocol[result.protocol];if(psychotic){result.hostname="";result.port=null;if(result.host){if(srcPath[0]==="")srcPath[0]=result.host;else srcPath.unshift(result.host)}result.host="";if(relative.protocol){relative.hostname=null;relative.port=null;if(relative.host){if(relPath[0]==="")relPath[0]=relative.host;else relPath.unshift(relative.host)}relative.host=null}mustEndAbs=mustEndAbs&&(relPath[0]===""||srcPath[0]==="")}if(isRelAbs){result.host=relative.host||relative.host===""?relative.host:result.host;result.hostname=relative.hostname||relative.hostname===""?relative.hostname:result.hostname;result.search=relative.search;result.query=relative.query;srcPath=relPath}else if(relPath.length){if(!srcPath)srcPath=[];srcPath.pop();srcPath=srcPath.concat(relPath);result.search=relative.search;result.query=relative.query}else if(!isNullOrUndefined(relative.search)){if(psychotic){result.hostname=result.host=srcPath.shift();var authInHost=result.host&&result.host.indexOf("@")>0?result.host.split("@"):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift()}}result.search=relative.search;result.query=relative.query;if(!isNull(result.pathname)||!isNull(result.search)){result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")}result.href=result.format();return result}if(!srcPath.length){result.pathname=null;if(result.search){result.path="/"+result.search}else{result.path=null}result.href=result.format();return result}var last=srcPath.slice(-1)[0];var hasTrailingSlash=(result.host||relative.host)&&(last==="."||last==="..")||last==="";var up=0;for(var i=srcPath.length;i>=0;i--){last=srcPath[i];if(last=="."){srcPath.splice(i,1)}else if(last===".."){srcPath.splice(i,1);up++}else if(up){srcPath.splice(i,1);up--}}if(!mustEndAbs&&!removeAllDots){for(;up--;up){srcPath.unshift("..")}}if(mustEndAbs&&srcPath[0]!==""&&(!srcPath[0]||srcPath[0].charAt(0)!=="/")){srcPath.unshift("")}if(hasTrailingSlash&&srcPath.join("/").substr(-1)!=="/"){srcPath.push("")}var isAbsolute=srcPath[0]===""||srcPath[0]&&srcPath[0].charAt(0)==="/";if(psychotic){result.hostname=result.host=isAbsolute?"":srcPath.length?srcPath.shift():"";var authInHost=result.host&&result.host.indexOf("@")>0?result.host.split("@"):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift()}}mustEndAbs=mustEndAbs||result.host&&srcPath.length;if(mustEndAbs&&!isAbsolute){srcPath.unshift("")}if(!srcPath.length){result.pathname=null;result.path=null}else{result.pathname=srcPath.join("/")}if(!isNull(result.pathname)||!isNull(result.search)){result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==":"){this.port=port.substr(1)}host=host.substr(0,host.length-port.length)}if(host)this.hostname=host};function isString(arg){return typeof arg==="string"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isNull(arg){return arg===null}function isNullOrUndefined(arg){return arg==null}},{punycode:2,querystring:5}],7:[function(require,module,exports){var baseClone=require("lodash._baseclone"),baseCreateCallback=require("lodash._basecreatecallback");function cloneDeep(value,callback,thisArg){return baseClone(value,true,typeof callback=="function"&&baseCreateCallback(callback,thisArg,1))}module.exports=cloneDeep},{"lodash._baseclone":8,"lodash._basecreatecallback":30}],8:[function(require,module,exports){var assign=require("lodash.assign"),forEach=require("lodash.foreach"),forOwn=require("lodash.forown"),getArray=require("lodash._getarray"),isArray=require("lodash.isarray"),isObject=require("lodash.isobject"),releaseArray=require("lodash._releasearray"),slice=require("lodash._slice");var reFlags=/\w*$/;var argsClass="[object Arguments]",arrayClass="[object Array]",boolClass="[object Boolean]",dateClass="[object Date]",funcClass="[object Function]",numberClass="[object Number]",objectClass="[object Object]",regexpClass="[object RegExp]",stringClass="[object String]";var cloneableClasses={};cloneableClasses[funcClass]=false;cloneableClasses[argsClass]=cloneableClasses[arrayClass]=cloneableClasses[boolClass]=cloneableClasses[dateClass]=cloneableClasses[numberClass]=cloneableClasses[objectClass]=cloneableClasses[regexpClass]=cloneableClasses[stringClass]=true;var objectProto=Object.prototype;var toString=objectProto.toString;var hasOwnProperty=objectProto.hasOwnProperty;var ctorByClass={};ctorByClass[arrayClass]=Array;ctorByClass[boolClass]=Boolean;ctorByClass[dateClass]=Date;ctorByClass[funcClass]=Function;ctorByClass[objectClass]=Object;ctorByClass[numberClass]=Number;ctorByClass[regexpClass]=RegExp;ctorByClass[stringClass]=String;function baseClone(value,isDeep,callback,stackA,stackB){if(callback){var result=callback(value);if(typeof result!="undefined"){return result}}var isObj=isObject(value);if(isObj){var className=toString.call(value);if(!cloneableClasses[className]){return value}var ctor=ctorByClass[className];switch(className){case boolClass:case dateClass:return new ctor(+value);case numberClass:case stringClass:return new ctor(value);case regexpClass:result=ctor(value.source,reFlags.exec(value));result.lastIndex=value.lastIndex;return result}}else{return value}var isArr=isArray(value);if(isDeep){var initedStack=!stackA;stackA||(stackA=getArray());stackB||(stackB=getArray());var length=stackA.length;while(length--){if(stackA[length]==value){return stackB[length]}}result=isArr?ctor(value.length):{}}else{result=isArr?slice(value):assign({},value)}if(isArr){if(hasOwnProperty.call(value,"index")){result.index=value.index}if(hasOwnProperty.call(value,"input")){result.input=value.input}}if(!isDeep){return result}stackA.push(value);stackB.push(result);(isArr?forEach:forOwn)(value,function(objValue,key){result[key]=baseClone(objValue,isDeep,callback,stackA,stackB)});if(initedStack){releaseArray(stackA);releaseArray(stackB)}return result}module.exports=baseClone},{"lodash._getarray":9,"lodash._releasearray":11,"lodash._slice":14,"lodash.assign":15,"lodash.foreach":20,"lodash.forown":21,"lodash.isarray":26,"lodash.isobject":28}],9:[function(require,module,exports){var arrayPool=require("lodash._arraypool");function getArray(){return arrayPool.pop()||[]}module.exports=getArray},{"lodash._arraypool":10}],10:[function(require,module,exports){var arrayPool=[];module.exports=arrayPool},{}],11:[function(require,module,exports){var arrayPool=require("lodash._arraypool"),maxPoolSize=require("lodash._maxpoolsize");function releaseArray(array){array.length=0;if(arrayPool.length<maxPoolSize){arrayPool.push(array)}}module.exports=releaseArray},{"lodash._arraypool":12,"lodash._maxpoolsize":13}],12:[function(require,module,exports){module.exports=require(10)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash._getarray/node_modules/lodash._arraypool/index.js":10}],13:[function(require,module,exports){var maxPoolSize=40;module.exports=maxPoolSize},{}],14:[function(require,module,exports){function slice(array,start,end){start||(start=0);if(typeof end=="undefined"){end=array?array.length:0}var index=-1,length=end-start||0,result=Array(length<0?0:length);while(++index<length){result[index]=array[start+index]}return result}module.exports=slice},{}],15:[function(require,module,exports){var baseCreateCallback=require("lodash._basecreatecallback"),keys=require("lodash.keys"),objectTypes=require("lodash._objecttypes");var assign=function(object,source,guard){var index,iterable=object,result=iterable;if(!iterable)return result;var args=arguments,argsIndex=0,argsLength=typeof guard=="number"?2:args.length;if(argsLength>3&&typeof args[argsLength-2]=="function"){var callback=baseCreateCallback(args[--argsLength-1],args[argsLength--],2)}else if(argsLength>2&&typeof args[argsLength-1]=="function"){callback=args[--argsLength]}while(++argsIndex<argsLength){iterable=args[argsIndex];if(iterable&&objectTypes[typeof iterable]){var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0; | ||
while(++ownIndex<length){index=ownProps[ownIndex];result[index]=callback?callback(result[index],iterable[index]):iterable[index]}}}return result};module.exports=assign},{"lodash._basecreatecallback":30,"lodash._objecttypes":16,"lodash.keys":17}],16:[function(require,module,exports){var objectTypes={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false};module.exports=objectTypes},{}],17:[function(require,module,exports){var isNative=require("lodash._isnative"),isObject=require("lodash.isobject"),shimKeys=require("lodash._shimkeys");var nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys;var keys=!nativeKeys?shimKeys:function(object){if(!isObject(object)){return[]}return nativeKeys(object)};module.exports=keys},{"lodash._isnative":18,"lodash._shimkeys":19,"lodash.isobject":28}],18:[function(require,module,exports){var objectProto=Object.prototype;var toString=objectProto.toString;var reNative=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");function isNative(value){return typeof value=="function"&&reNative.test(value)}module.exports=isNative},{}],19:[function(require,module,exports){var objectTypes=require("lodash._objecttypes");var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;var shimKeys=function(object){var index,iterable=object,result=[];if(!iterable)return result;if(!objectTypes[typeof object])return result;for(index in iterable){if(hasOwnProperty.call(iterable,index)){result.push(index)}}return result};module.exports=shimKeys},{"lodash._objecttypes":16}],20:[function(require,module,exports){var baseCreateCallback=require("lodash._basecreatecallback"),forOwn=require("lodash.forown");function forEach(collection,callback,thisArg){var index=-1,length=collection?collection.length:0;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);if(typeof length=="number"){while(++index<length){if(callback(collection[index],index,collection)===false){break}}}else{forOwn(collection,callback)}return collection}module.exports=forEach},{"lodash._basecreatecallback":30,"lodash.forown":21}],21:[function(require,module,exports){var baseCreateCallback=require("lodash._basecreatecallback"),keys=require("lodash.keys"),objectTypes=require("lodash._objecttypes");var forOwn=function(collection,callback,thisArg){var index,iterable=collection,result=iterable;if(!iterable)return result;if(!objectTypes[typeof iterable])return result;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];if(callback(iterable[index],index,collection)===false)return result}return result};module.exports=forOwn},{"lodash._basecreatecallback":30,"lodash._objecttypes":22,"lodash.keys":23}],22:[function(require,module,exports){module.exports=require(16)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash._objecttypes/index.js":16}],23:[function(require,module,exports){module.exports=require(17)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/index.js":17,"lodash._isnative":24,"lodash._shimkeys":25,"lodash.isobject":28}],24:[function(require,module,exports){module.exports=require(18)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._isnative/index.js":18}],25:[function(require,module,exports){module.exports=require(19)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._shimkeys/index.js":19,"lodash._objecttypes":22}],26:[function(require,module,exports){var isNative=require("lodash._isnative");var arrayClass="[object Array]";var objectProto=Object.prototype;var toString=objectProto.toString;var nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray;var isArray=nativeIsArray||function(value){return value&&typeof value=="object"&&typeof value.length=="number"&&toString.call(value)==arrayClass||false};module.exports=isArray},{"lodash._isnative":27}],27:[function(require,module,exports){module.exports=require(18)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._isnative/index.js":18}],28:[function(require,module,exports){var objectTypes=require("lodash._objecttypes");function isObject(value){return!!(value&&objectTypes[typeof value])}module.exports=isObject},{"lodash._objecttypes":29}],29:[function(require,module,exports){module.exports=require(16)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash._objecttypes/index.js":16}],30:[function(require,module,exports){var bind=require("lodash.bind"),identity=require("lodash.identity"),setBindData=require("lodash._setbinddata"),support=require("lodash.support");var reFuncName=/^\s*function[ \n\r\t]+\w/;var reThis=/\bthis\b/;var fnToString=Function.prototype.toString;function baseCreateCallback(func,thisArg,argCount){if(typeof func!="function"){return identity}if(typeof thisArg=="undefined"||!("prototype"in func)){return func}var bindData=func.__bindData__;if(typeof bindData=="undefined"){if(support.funcNames){bindData=!func.name}bindData=bindData||!support.funcDecomp;if(!bindData){var source=fnToString.call(func);if(!support.funcNames){bindData=!reFuncName.test(source)}if(!bindData){bindData=reThis.test(source);setBindData(func,bindData)}}}if(bindData===false||bindData!==true&&bindData[1]&1){return func}switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 2:return function(a,b){return func.call(thisArg,a,b)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)}}return bind(func,thisArg)}module.exports=baseCreateCallback},{"lodash._setbinddata":31,"lodash.bind":34,"lodash.identity":50,"lodash.support":51}],31:[function(require,module,exports){var isNative=require("lodash._isnative"),noop=require("lodash.noop");var descriptor={configurable:false,enumerable:false,value:null,writable:false};var defineProperty=function(){try{var o={},func=isNative(func=Object.defineProperty)&&func,result=func(o,o,o)&&func}catch(e){}return result}();var setBindData=!defineProperty?noop:function(func,value){descriptor.value=value;defineProperty(func,"__bindData__",descriptor)};module.exports=setBindData},{"lodash._isnative":32,"lodash.noop":33}],32:[function(require,module,exports){module.exports=require(18)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._isnative/index.js":18}],33:[function(require,module,exports){function noop(){}module.exports=noop},{}],34:[function(require,module,exports){var createWrapper=require("lodash._createwrapper"),slice=require("lodash._slice");function bind(func,thisArg){return arguments.length>2?createWrapper(func,17,slice(arguments,2),null,thisArg):createWrapper(func,1,null,null,thisArg)}module.exports=bind},{"lodash._createwrapper":35,"lodash._slice":49}],35:[function(require,module,exports){var baseBind=require("lodash._basebind"),baseCreateWrapper=require("lodash._basecreatewrapper"),isFunction=require("lodash.isfunction"),slice=require("lodash._slice");var arrayRef=[];var push=arrayRef.push,unshift=arrayRef.unshift;function createWrapper(func,bitmask,partialArgs,partialRightArgs,thisArg,arity){var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,isPartial=bitmask&16,isPartialRight=bitmask&32;if(!isBindKey&&!isFunction(func)){throw new TypeError}if(isPartial&&!partialArgs.length){bitmask&=~16;isPartial=partialArgs=false}if(isPartialRight&&!partialRightArgs.length){bitmask&=~32;isPartialRight=partialRightArgs=false}var bindData=func&&func.__bindData__;if(bindData&&bindData!==true){bindData=slice(bindData);if(bindData[2]){bindData[2]=slice(bindData[2])}if(bindData[3]){bindData[3]=slice(bindData[3])}if(isBind&&!(bindData[1]&1)){bindData[4]=thisArg}if(!isBind&&bindData[1]&1){bitmask|=8}if(isCurry&&!(bindData[1]&4)){bindData[5]=arity}if(isPartial){push.apply(bindData[2]||(bindData[2]=[]),partialArgs)}if(isPartialRight){unshift.apply(bindData[3]||(bindData[3]=[]),partialRightArgs)}bindData[1]|=bitmask;return createWrapper.apply(null,bindData)}var creater=bitmask==1||bitmask===17?baseBind:baseCreateWrapper;return creater([func,bitmask,partialArgs,partialRightArgs,thisArg,arity])}module.exports=createWrapper},{"lodash._basebind":36,"lodash._basecreatewrapper":42,"lodash._slice":49,"lodash.isfunction":48}],36:[function(require,module,exports){var baseCreate=require("lodash._basecreate"),isObject=require("lodash.isobject"),setBindData=require("lodash._setbinddata"),slice=require("lodash._slice");var arrayRef=[];var push=arrayRef.push;function baseBind(bindData){var func=bindData[0],partialArgs=bindData[2],thisArg=bindData[4];function bound(){if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(this instanceof bound){var thisBinding=baseCreate(func.prototype),result=func.apply(thisBinding,args||arguments);return isObject(result)?result:thisBinding}return func.apply(thisArg,args||arguments)}setBindData(bound,bindData);return bound}module.exports=baseBind},{"lodash._basecreate":37,"lodash._setbinddata":31,"lodash._slice":49,"lodash.isobject":40}],37:[function(require,module,exports){(function(global){var isNative=require("lodash._isnative"),isObject=require("lodash.isobject"),noop=require("lodash.noop");var nativeCreate=isNative(nativeCreate=Object.create)&&nativeCreate;function baseCreate(prototype,properties){return isObject(prototype)?nativeCreate(prototype):{}}if(!nativeCreate){baseCreate=function(){function Object(){}return function(prototype){if(isObject(prototype)){Object.prototype=prototype;var result=new Object;Object.prototype=null}return result||global.Object()}}()}module.exports=baseCreate}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"lodash._isnative":38,"lodash.isobject":40,"lodash.noop":39}],38:[function(require,module,exports){module.exports=require(18)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._isnative/index.js":18}],39:[function(require,module,exports){module.exports=require(33)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":33}],40:[function(require,module,exports){module.exports=require(28)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.isobject/index.js":28,"lodash._objecttypes":41}],41:[function(require,module,exports){module.exports=require(16)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash._objecttypes/index.js":16}],42:[function(require,module,exports){var baseCreate=require("lodash._basecreate"),isObject=require("lodash.isobject"),setBindData=require("lodash._setbinddata"),slice=require("lodash._slice");var arrayRef=[];var push=arrayRef.push;function baseCreateWrapper(bindData){var func=bindData[0],bitmask=bindData[1],partialArgs=bindData[2],partialRightArgs=bindData[3],thisArg=bindData[4],arity=bindData[5];var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,key=func;function bound(){var thisBinding=isBind?thisArg:this;if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(partialRightArgs||isCurry){args||(args=slice(arguments));if(partialRightArgs){push.apply(args,partialRightArgs)}if(isCurry&&args.length<arity){bitmask|=16&~32;return baseCreateWrapper([func,isCurryBound?bitmask:bitmask&~3,args,null,thisArg,arity])}}args||(args=arguments);if(isBindKey){func=thisBinding[key]}if(this instanceof bound){thisBinding=baseCreate(func.prototype);var result=func.apply(thisBinding,args);return isObject(result)?result:thisBinding}return func.apply(thisBinding,args)}setBindData(bound,bindData);return bound}module.exports=baseCreateWrapper},{"lodash._basecreate":43,"lodash._setbinddata":31,"lodash._slice":49,"lodash.isobject":46}],43:[function(require,module,exports){module.exports=require(37)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash._basebind/node_modules/lodash._basecreate/index.js":37,"lodash._isnative":44,"lodash.isobject":46,"lodash.noop":45}],44:[function(require,module,exports){module.exports=require(18)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._isnative/index.js":18}],45:[function(require,module,exports){module.exports=require(33)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":33}],46:[function(require,module,exports){module.exports=require(28)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.isobject/index.js":28,"lodash._objecttypes":47}],47:[function(require,module,exports){module.exports=require(16)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash._objecttypes/index.js":16}],48:[function(require,module,exports){function isFunction(value){return typeof value=="function"}module.exports=isFunction},{}],49:[function(require,module,exports){module.exports=require(14)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash._slice/index.js":14}],50:[function(require,module,exports){function identity(value){return value}module.exports=identity},{}],51:[function(require,module,exports){(function(global){var isNative=require("lodash._isnative");var reThis=/\bthis\b/;var support={};support.funcDecomp=!isNative(global.WinRTError)&&reThis.test(function(){return this});support.funcNames=typeof Function.name=="string";module.exports=support}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"lodash._isnative":52}],52:[function(require,module,exports){module.exports=require(18)},{"/Users/mohsen/apigee/swagger-converter/node_modules/lodash.clonedeep/node_modules/lodash._baseclone/node_modules/lodash.assign/node_modules/lodash.keys/node_modules/lodash._isnative/index.js":18}]},{},[1]); |
57
index.js
@@ -28,2 +28,12 @@ /* | ||
var primitiveTypes = [ | ||
'string', | ||
'number', | ||
'boolean', | ||
'integer', | ||
'array', | ||
'void', | ||
'File' | ||
]; | ||
if (typeof window === 'undefined') { | ||
@@ -74,3 +84,11 @@ module.exports = convert; | ||
if (Array.isArray(resourceListing.apis)) { | ||
if (apiDeclarations.length > 0) { | ||
result.tags = []; | ||
} | ||
resourceListing.apis.forEach(function(api) { | ||
if (result.tags) { | ||
result.tags.push({ | ||
'name': api.path.replace('.{format}', '').substring(1), | ||
'description': api.description}); | ||
} | ||
if (Array.isArray(api.operations)) { | ||
@@ -174,3 +192,3 @@ result.paths[api.path] = buildPath(api, resourceListing); | ||
*/ | ||
function processDataType(field) { | ||
function processDataType(field, fixRef) { | ||
field = clone(field); | ||
@@ -187,2 +205,8 @@ | ||
if (fixRef) { | ||
if (field.type && primitiveTypes.indexOf(field.type) === -1) { | ||
field = {$ref: '#/definitions/' + field.type}; | ||
} | ||
} | ||
if (field.type === 'integer') { | ||
@@ -233,3 +257,3 @@ if (field.minimum) { | ||
path[method] = buildOperation(oldOperation, apiDeclaration.produces, | ||
apiDeclaration.consumes); | ||
apiDeclaration.consumes, apiDeclaration.resourcePath); | ||
}); | ||
@@ -247,3 +271,3 @@ | ||
*/ | ||
function buildOperation(oldOperation, produces, consumes) { | ||
function buildOperation(oldOperation, produces, consumes, resourcePath) { | ||
var operation = { | ||
@@ -254,2 +278,7 @@ responses: {}, | ||
if (resourcePath) { | ||
operation.tags = []; | ||
operation.tags.push(resourcePath.substr(1)); | ||
} | ||
if (oldOperation.summary) { | ||
@@ -269,3 +298,3 @@ operation.summary = oldOperation.summary; | ||
operation.parameters = oldOperation.parameters.map(function(parameter) { | ||
return buildParameter(processDataType(parameter)); | ||
return buildParameter(processDataType(parameter, false)); | ||
}); | ||
@@ -280,2 +309,11 @@ } | ||
if (oldOperation.type && oldOperation.type !== 'void' && | ||
primitiveTypes.indexOf(oldOperation.type) === -1) { | ||
operation.responses['default'] = { | ||
'schema': { | ||
'$ref': '#/definitions/' + oldOperation.type, | ||
} | ||
}; | ||
} | ||
if (!Object.keys(operation.responses).length) { | ||
@@ -318,11 +356,2 @@ operation.responses = { | ||
}; | ||
var primitiveTypes = [ | ||
'string', | ||
'number', | ||
'boolean', | ||
'integer', | ||
'array', | ||
'void', | ||
'File' | ||
]; | ||
var copyProperties = [ | ||
@@ -452,3 +481,3 @@ 'default', | ||
model.properties[propertieName] = | ||
processDataType(model.properties[propertieName]); | ||
processDataType(model.properties[propertieName], true); | ||
}); | ||
@@ -455,0 +484,0 @@ } |
{ | ||
"name": "swagger-converter", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Swagger Converter", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,3 +5,3 @@ # Swagger Converter | ||
Swagger Converter converts [Swagger](http://swagger.io/) documents from version **1.2** to version **2.0** | ||
> Converts [Swagger](http://swagger.io/) documents from version **`1.2`** to version **`2.0`** | ||
@@ -23,8 +23,9 @@ ### Installation | ||
var convert = require('swagger-converter'); | ||
var fs = require('fs'); | ||
var resourceListing = JSON.parse(fs.readFileSync('/path/to/petstore/index.json').toString()); | ||
var resourceListing = require('/path/to/petstore/index.json'); | ||
var apiDeclarations = [ | ||
JSON.parse(fs.readFileSync('/path/to/petstore/pet.json').toString()), | ||
JSON.parse(fs.readFileSync('/path/to/petstore/user.json').toString()), | ||
JSON.parse(fs.readFileSync('/path/to/petstore/store.json').toString()) | ||
require('/path/to/petstore/pet.json'), | ||
require('/path/to/petstore/user.json'), | ||
require('/path/to/petstore/store.json') | ||
]; | ||
@@ -34,3 +35,3 @@ | ||
console.log(JSON.stringify(swagger2Document, null, 2)); | ||
console.log(swagger2Document); | ||
``` | ||
@@ -37,0 +38,0 @@ |
@@ -7,3 +7,3 @@ { | ||
"path": "/pets", | ||
"description": "" | ||
"description": "A list of pets" | ||
} | ||
@@ -10,0 +10,0 @@ ], |
@@ -411,3 +411,3 @@ { | ||
"id": { | ||
"type": "long" | ||
"type": "integer" | ||
}, | ||
@@ -414,0 +414,0 @@ "type": { |
@@ -15,6 +15,13 @@ { | ||
} | ||
} | ||
}, | ||
"tags": [ | ||
"pets" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"tags": [{ | ||
"description": "A list of pets", | ||
"name": "pets" | ||
}] | ||
} |
@@ -16,2 +16,15 @@ { | ||
}, | ||
"tags": [ | ||
{ | ||
"description": "Operations about pets", | ||
"name": "pet" | ||
}, | ||
{ | ||
"description": "Operations about user", | ||
"name": "user" | ||
}, | ||
{ | ||
"description": "Operations about store", | ||
"name": "store" | ||
}], | ||
"paths": { | ||
@@ -34,2 +47,5 @@ "/pet": { | ||
"operationId": "updatePet", | ||
"tags": [ | ||
"pet" | ||
], | ||
"produces": [ | ||
@@ -64,2 +80,5 @@ "application/json", | ||
"operationId": "findPetsByStatus", | ||
"tags": [ | ||
"pet" | ||
], | ||
"produces": [ | ||
@@ -92,2 +111,5 @@ "application/json", | ||
"operationId": "findPetsByTags", | ||
"tags": [ | ||
"pet" | ||
], | ||
"produces": [ | ||
@@ -120,2 +142,5 @@ "application/json", | ||
"operationId": "updatePetWithForm", | ||
"tags": [ | ||
"pet" | ||
], | ||
"produces": [ | ||
@@ -158,2 +183,7 @@ "application/json", | ||
"description": "Pet not found" | ||
}, | ||
"default": { | ||
"schema": { | ||
"$ref": "#/definitions/Pet" | ||
} | ||
} | ||
@@ -164,2 +194,5 @@ }, | ||
"operationId": "getPetById", | ||
"tags": [ | ||
"pet" | ||
], | ||
"produces": [ | ||
@@ -193,2 +226,5 @@ "application/json", | ||
"operationId": "deletePet", | ||
"tags": [ | ||
"pet" | ||
], | ||
"produces": [ | ||
@@ -219,2 +255,5 @@ "application/json", | ||
"operationId": "partialUpdate", | ||
"tags": [ | ||
"pet" | ||
], | ||
"produces": [ | ||
@@ -256,2 +295,5 @@ "application/json", | ||
"operationId": "uploadFile", | ||
"tags": [ | ||
"pet" | ||
], | ||
"produces": [ | ||
@@ -291,2 +333,5 @@ "application/json", | ||
"operationId": "createUsersWithArrayInput", | ||
"tags": [ | ||
"user" | ||
], | ||
"produces": [ | ||
@@ -319,2 +364,5 @@ "application/json" | ||
"operationId": "createUsersWithListInput", | ||
"tags": [ | ||
"user" | ||
], | ||
"produces": [ | ||
@@ -350,2 +398,5 @@ "application/json" | ||
"operationId": "updateUser", | ||
"tags": [ | ||
"user" | ||
], | ||
"produces": [ | ||
@@ -385,2 +436,5 @@ "application/json" | ||
"operationId": "deleteUser", | ||
"tags": [ | ||
"user" | ||
], | ||
"produces": [ | ||
@@ -406,2 +460,7 @@ "application/json" | ||
"description": "User not found" | ||
}, | ||
"default": { | ||
"schema": { | ||
"$ref": "#/definitions/User" | ||
} | ||
} | ||
@@ -412,2 +471,5 @@ }, | ||
"operationId": "getUserByName", | ||
"tags": [ | ||
"user" | ||
], | ||
"produces": [ | ||
@@ -437,2 +499,5 @@ "application/json" | ||
"operationId": "loginUser", | ||
"tags": [ | ||
"user" | ||
], | ||
"produces": [ | ||
@@ -469,2 +534,5 @@ "application/json" | ||
"operationId": "logoutUser", | ||
"tags": [ | ||
"user" | ||
], | ||
"produces": [ | ||
@@ -485,2 +553,5 @@ "application/json" | ||
"operationId": "createUser", | ||
"tags": [ | ||
"user" | ||
], | ||
"produces": [ | ||
@@ -512,2 +583,5 @@ "application/json" | ||
"operationId": "placeOrder", | ||
"tags": [ | ||
"store" | ||
], | ||
"produces": [ | ||
@@ -542,2 +616,5 @@ "application/json" | ||
"operationId": "deleteOrder", | ||
"tags": [ | ||
"store" | ||
], | ||
"produces": [ | ||
@@ -563,2 +640,7 @@ "application/json" | ||
"description": "Order not found" | ||
}, | ||
"default": { | ||
"schema": { | ||
"$ref": "#/definitions/Order" | ||
} | ||
} | ||
@@ -569,2 +651,5 @@ }, | ||
"operationId": "getOrderById", | ||
"tags": [ | ||
"store" | ||
], | ||
"produces": [ | ||
@@ -684,3 +769,3 @@ "application/json" | ||
"id": { | ||
"type": "long" | ||
"type": "integer" | ||
}, | ||
@@ -687,0 +772,0 @@ "type": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
236071
5576
62