diff --git a/dist/lib/swagger.js b/dist/lib/swagger.js index 0a10dd6f..8ea25d7b 100644 --- a/dist/lib/swagger.js +++ b/dist/lib/swagger.js @@ -1,5 +1,5 @@ // swagger.js -// version 2.0.36 +// version 2.0.37 var __bind = function(fn, me){ return function(){ @@ -45,41 +45,40 @@ if (!('map' in Array.prototype)) { } Object.keys = Object.keys || (function () { - var hasOwnProperty = Object.prototype.hasOwnProperty, - hasDontEnumBug = !{toString:null}.propertyIsEnumerable("toString"), - DontEnums = [ - 'toString', - 'toLocaleString', - 'valueOf', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'constructor' - ], - DontEnumsLength = DontEnums.length; - - return function (o) { - if (typeof o != "object" && typeof o != "function" || o === null) - throw new TypeError("Object.keys called on a non-object"); - - var result = []; - for (var name in o) { - if (hasOwnProperty.call(o, name)) - result.push(name); - } + var hasOwnProperty = Object.prototype.hasOwnProperty, + hasDontEnumBug = !{toString:null}.propertyIsEnumerable("toString"), + DontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ], + DontEnumsLength = DontEnums.length; + + return function (o) { + if (typeof o != "object" && typeof o != "function" || o === null) + throw new TypeError("Object.keys called on a non-object"); + + var result = []; + for (var name in o) { + if (hasOwnProperty.call(o, name)) + result.push(name); + } - if (hasDontEnumBug) { - for (var i = 0; i < DontEnumsLength; i++) { - if (hasOwnProperty.call(o, DontEnums[i])) - result.push(DontEnums[i]); - } - } + if (hasDontEnumBug) { + for (var i = 0; i < DontEnumsLength; i++) { + if (hasOwnProperty.call(o, DontEnums[i])) + result.push(DontEnums[i]); + } + } - return result; - }; + return result; + }; })(); - var SwaggerApi = function(url, options) { this.url = null; this.debug = false; @@ -158,6 +157,7 @@ SwaggerApi.prototype.buildFromSpec = function(response) { } this.apis = {}; this.apisArray = []; + this.consumes = response.consumes; this.produces = response.produces; this.authSchemes = response.authorizations; if (response.info != null) { @@ -175,13 +175,13 @@ SwaggerApi.prototype.buildFromSpec = function(response) { } } } - if (response.basePath) { + if (response.basePath) this.basePath = response.basePath; - } else if (this.url.indexOf('?') > 0) { + else if (this.url.indexOf('?') > 0) this.basePath = this.url.substring(0, this.url.lastIndexOf('?')); - } else { + else this.basePath = this.url; - } + if (isApi) { var newName = response.resourcePath.replace(/\//g, ''); this.resourcePath = response.resourcePath; @@ -321,8 +321,8 @@ var SwaggerResource = function(resourceObj, api) { var _this = this; this.api = api; this.api = this.api; - produces = []; - consumes = []; + consumes = (this.consumes | []); + produces = (this.produces | []); this.path = this.api.resourcePath != null ? this.api.resourcePath : resourceObj.path; this.description = resourceObj.description; @@ -1191,7 +1191,7 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal SwaggerRequest.prototype.setHeaders = function(params, operation) { // default type var accepts = "application/json"; - var contentType = null; + var consumes = "application/json"; var allDefinedParams = this.operation.parameters; var definedFormParams = []; diff --git a/dist/swagger-ui.js b/dist/swagger-ui.js index 366a3eb3..643a650f 100644 --- a/dist/swagger-ui.js +++ b/dist/swagger-ui.js @@ -1,5 +1,5 @@ // swagger-ui.js -// version 2.0.21 +// version 2.0.22 $(function() { // Helper function for vertically aligning DOM elements diff --git a/lib/swagger.js b/lib/swagger.js index 0a10dd6f..8ea25d7b 100644 --- a/lib/swagger.js +++ b/lib/swagger.js @@ -1,5 +1,5 @@ // swagger.js -// version 2.0.36 +// version 2.0.37 var __bind = function(fn, me){ return function(){ @@ -45,41 +45,40 @@ if (!('map' in Array.prototype)) { } Object.keys = Object.keys || (function () { - var hasOwnProperty = Object.prototype.hasOwnProperty, - hasDontEnumBug = !{toString:null}.propertyIsEnumerable("toString"), - DontEnums = [ - 'toString', - 'toLocaleString', - 'valueOf', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'constructor' - ], - DontEnumsLength = DontEnums.length; - - return function (o) { - if (typeof o != "object" && typeof o != "function" || o === null) - throw new TypeError("Object.keys called on a non-object"); - - var result = []; - for (var name in o) { - if (hasOwnProperty.call(o, name)) - result.push(name); - } + var hasOwnProperty = Object.prototype.hasOwnProperty, + hasDontEnumBug = !{toString:null}.propertyIsEnumerable("toString"), + DontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ], + DontEnumsLength = DontEnums.length; + + return function (o) { + if (typeof o != "object" && typeof o != "function" || o === null) + throw new TypeError("Object.keys called on a non-object"); + + var result = []; + for (var name in o) { + if (hasOwnProperty.call(o, name)) + result.push(name); + } - if (hasDontEnumBug) { - for (var i = 0; i < DontEnumsLength; i++) { - if (hasOwnProperty.call(o, DontEnums[i])) - result.push(DontEnums[i]); - } - } + if (hasDontEnumBug) { + for (var i = 0; i < DontEnumsLength; i++) { + if (hasOwnProperty.call(o, DontEnums[i])) + result.push(DontEnums[i]); + } + } - return result; - }; + return result; + }; })(); - var SwaggerApi = function(url, options) { this.url = null; this.debug = false; @@ -158,6 +157,7 @@ SwaggerApi.prototype.buildFromSpec = function(response) { } this.apis = {}; this.apisArray = []; + this.consumes = response.consumes; this.produces = response.produces; this.authSchemes = response.authorizations; if (response.info != null) { @@ -175,13 +175,13 @@ SwaggerApi.prototype.buildFromSpec = function(response) { } } } - if (response.basePath) { + if (response.basePath) this.basePath = response.basePath; - } else if (this.url.indexOf('?') > 0) { + else if (this.url.indexOf('?') > 0) this.basePath = this.url.substring(0, this.url.lastIndexOf('?')); - } else { + else this.basePath = this.url; - } + if (isApi) { var newName = response.resourcePath.replace(/\//g, ''); this.resourcePath = response.resourcePath; @@ -321,8 +321,8 @@ var SwaggerResource = function(resourceObj, api) { var _this = this; this.api = api; this.api = this.api; - produces = []; - consumes = []; + consumes = (this.consumes | []); + produces = (this.produces | []); this.path = this.api.resourcePath != null ? this.api.resourcePath : resourceObj.path; this.description = resourceObj.description; @@ -1191,7 +1191,7 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal SwaggerRequest.prototype.setHeaders = function(params, operation) { // default type var accepts = "application/json"; - var contentType = null; + var consumes = "application/json"; var allDefinedParams = this.operation.parameters; var definedFormParams = []; diff --git a/package.json b/package.json index b98742f9..19e25b56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "swagger-ui", - "version": "2.0.21", + "version": "2.0.22", "description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API", "scripts": { "build": "PATH=$PATH:./node_modules/.bin cake dist",