updated versions, swagger-js

This commit is contained in:
Tony Tam
2014-07-12 20:14:38 -07:00
parent 011f70935d
commit 7945dec86c
4 changed files with 32 additions and 24 deletions

24
dist/lib/swagger.js vendored
View File

@@ -372,20 +372,24 @@ var SwaggerResource = function(resourceObj, api) {
} }
} }
SwaggerResource.prototype.getAbsoluteBasePath = function(relativeBasePath) { SwaggerResource.prototype.getAbsoluteBasePath = function (relativeBasePath) {
var parts, pos, url; var pos, url;
url = this.api.basePath; url = this.api.basePath;
pos = url.lastIndexOf(relativeBasePath); pos = url.lastIndexOf(relativeBasePath);
if (pos === -1) { var parts = url.split("/");
parts = url.split("/"); var rootUrl = parts[0] + "//" + parts[2];
url = parts[0] + "//" + parts[2]; //if the relative path is '/' return the root url
if (relativeBasePath === '/'){
return rootUrl
}
//if the relative path is not in the base path
else if (pos === -1 ) {
if (relativeBasePath.indexOf("/") === 0) { if (relativeBasePath.indexOf("/") === 0) {
return url + relativeBasePath; return url + relativeBasePath;
} else { } else {
return url + "/" + relativeBasePath; return url + "/" + relativeBasePath;
} }
} else if (relativeBasePath === "/") { //If the relative path is in the base path
return url.substring(0, pos);
} else { } else {
return url.substring(0, pos) + relativeBasePath; return url.substring(0, pos) + relativeBasePath;
} }
@@ -1271,7 +1275,7 @@ SwaggerHttp.prototype.isIE8 = function() {
var JQueryHttpClient = function(options) { var JQueryHttpClient = function(options) {
"use strict"; "use strict";
if(!jQuery){ if(!jQuery){
var jQuery = window.jQuery; var jQuery = window.jQuery;
} }
} }
@@ -1467,8 +1471,8 @@ SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
var status = null; var status = null;
var key; var key;
if(typeof authorizations === 'undefined') { // if the "authorizations" key is undefined, or has an empty array, add all keys
// apply all keys since no authorizations hash is defined if(typeof authorizations === 'undefined' || Object.keys(authorizations).length == 0) {
for (key in this.authz) { for (key in this.authz) {
value = this.authz[key]; value = this.authz[key];
result = value.apply(obj, authorizations); result = value.apply(obj, authorizations);

2
dist/swagger-ui.js vendored
View File

@@ -1,5 +1,5 @@
// swagger-ui.js // swagger-ui.js
// version 2.0.17 // version 2.0.18
$(function() { $(function() {
// Helper function for vertically aligning DOM elements // Helper function for vertically aligning DOM elements

View File

@@ -372,20 +372,24 @@ var SwaggerResource = function(resourceObj, api) {
} }
} }
SwaggerResource.prototype.getAbsoluteBasePath = function(relativeBasePath) { SwaggerResource.prototype.getAbsoluteBasePath = function (relativeBasePath) {
var parts, pos, url; var pos, url;
url = this.api.basePath; url = this.api.basePath;
pos = url.lastIndexOf(relativeBasePath); pos = url.lastIndexOf(relativeBasePath);
if (pos === -1) { var parts = url.split("/");
parts = url.split("/"); var rootUrl = parts[0] + "//" + parts[2];
url = parts[0] + "//" + parts[2]; //if the relative path is '/' return the root url
if (relativeBasePath === '/'){
return rootUrl
}
//if the relative path is not in the base path
else if (pos === -1 ) {
if (relativeBasePath.indexOf("/") === 0) { if (relativeBasePath.indexOf("/") === 0) {
return url + relativeBasePath; return url + relativeBasePath;
} else { } else {
return url + "/" + relativeBasePath; return url + "/" + relativeBasePath;
} }
} else if (relativeBasePath === "/") { //If the relative path is in the base path
return url.substring(0, pos);
} else { } else {
return url.substring(0, pos) + relativeBasePath; return url.substring(0, pos) + relativeBasePath;
} }
@@ -1271,7 +1275,7 @@ SwaggerHttp.prototype.isIE8 = function() {
var JQueryHttpClient = function(options) { var JQueryHttpClient = function(options) {
"use strict"; "use strict";
if(!jQuery){ if(!jQuery){
var jQuery = window.jQuery; var jQuery = window.jQuery;
} }
} }
@@ -1467,8 +1471,8 @@ SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
var status = null; var status = null;
var key; var key;
if(typeof authorizations === 'undefined') { // if the "authorizations" key is undefined, or has an empty array, add all keys
// apply all keys since no authorizations hash is defined if(typeof authorizations === 'undefined' || Object.keys(authorizations).length == 0) {
for (key in this.authz) { for (key in this.authz) {
value = this.authz[key]; value = this.authz[key];
result = value.apply(obj, authorizations); result = value.apply(obj, authorizations);

View File

@@ -1,6 +1,6 @@
{ {
"name": "swagger-ui", "name": "swagger-ui",
"version": "2.0.17", "version": "2.0.18",
"description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API", "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": { "scripts": {
"build": "PATH=$PATH:./node_modules/.bin cake dist", "build": "PATH=$PATH:./node_modules/.bin cake dist",