Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa848529c0 | ||
|
|
7108afc191 | ||
|
|
0095768ab7 | ||
|
|
31e772f0bf | ||
|
|
b41b200061 |
Vendored
+22
-17
@@ -1,5 +1,5 @@
|
||||
// swagger.js
|
||||
// version 2.0.15
|
||||
// version 2.0.19
|
||||
|
||||
var __bind = function(fn, me){
|
||||
return function(){
|
||||
@@ -67,7 +67,7 @@ SwaggerApi.prototype.build = function() {
|
||||
}
|
||||
},
|
||||
response: function(resp) {
|
||||
var responseObj = resp.obj;
|
||||
var responseObj = resp.obj || JSON.parse(resp.data);
|
||||
_this.swaggerVersion = responseObj.swaggerVersion;
|
||||
if (_this.swaggerVersion === "1.2") {
|
||||
return _this.buildFromSpec(responseObj);
|
||||
@@ -284,8 +284,8 @@ var SwaggerResource = function(resourceObj, api) {
|
||||
accept: "application/json"
|
||||
},
|
||||
on: {
|
||||
response: function(response) {
|
||||
var responseObj = response.obj;
|
||||
response: function(resp) {
|
||||
var responseObj = resp.obj || JSON.parse(resp.data);
|
||||
return _this.addApiDeclaration(responseObj);
|
||||
},
|
||||
error: function(response) {
|
||||
@@ -478,11 +478,11 @@ SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
|
||||
if (!modelsToIgnore)
|
||||
modelsToIgnore = [];
|
||||
modelsToIgnore.push(this);
|
||||
modelsToIgnore.push(this.name);
|
||||
|
||||
for (var i = 0; i < this.properties.length; i++) {
|
||||
prop = this.properties[i];
|
||||
if ((prop.refModel != null) && modelsToIgnore.indexOf(prop.refModel) === -1) {
|
||||
if ((prop.refModel != null) && modelsToIgnore.indexOf(prop.refModel.name) === -1) {
|
||||
returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore));
|
||||
}
|
||||
}
|
||||
@@ -534,7 +534,7 @@ var SwaggerModelProperty = function(name, obj) {
|
||||
|
||||
SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) {
|
||||
var result;
|
||||
if ((this.refModel != null) && (modelsToIgnore[this.refModel.name] === undefined)) {
|
||||
if ((this.refModel != null) && (modelsToIgnore.indexOf(prop.refModel.name) === -1)) {
|
||||
result = this.refModel.createJSONSample(modelsToIgnore);
|
||||
} else {
|
||||
if (this.isCollection) {
|
||||
@@ -622,6 +622,9 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
|
||||
|
||||
// for 1.1 compatibility
|
||||
var type = param.type || param.dataType;
|
||||
if(type === 'array') {
|
||||
type = 'array[' + (param.items.$ref ? param.items.$ref : param.items.type) + ']';
|
||||
}
|
||||
|
||||
if(type.toLowerCase() === 'boolean') {
|
||||
param.allowableValues = {};
|
||||
@@ -636,7 +639,7 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
|
||||
param.allowableValues = {};
|
||||
param.allowableValues.descriptiveValues = [];
|
||||
|
||||
for(j = 0; j < enumValue.length; j++) {
|
||||
for(var j = 0; j < enumValue.length; j++) {
|
||||
var v = enumValue[j];
|
||||
if(param.defaultValue != null) {
|
||||
param.allowableValues.descriptiveValues.push ({
|
||||
@@ -652,7 +655,7 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
|
||||
}
|
||||
}
|
||||
}
|
||||
if(param.allowableValues != null) {
|
||||
else if(param.allowableValues != null) {
|
||||
if(param.allowableValues.valueType === "RANGE")
|
||||
param.isRange = true;
|
||||
else
|
||||
@@ -660,7 +663,7 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
|
||||
if(param.allowableValues != null) {
|
||||
param.allowableValues.descriptiveValues = [];
|
||||
if(param.allowableValues.values) {
|
||||
for(j = 0; j < param.allowableValues.values.length; j++){
|
||||
for(var j = 0; j < param.allowableValues.values.length; j++){
|
||||
var v = param.allowableValues.values[j];
|
||||
if(param.defaultValue != null) {
|
||||
param.allowableValues.descriptiveValues.push ({
|
||||
@@ -688,7 +691,7 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
|
||||
}
|
||||
|
||||
SwaggerOperation.prototype.isListType = function(type) {
|
||||
if (type.indexOf('[') >= 0) {
|
||||
if (type && type.indexOf('[') >= 0) {
|
||||
return type.substring(type.indexOf('[') + 1, type.indexOf(']'));
|
||||
} else {
|
||||
return void 0;
|
||||
@@ -828,7 +831,8 @@ SwaggerOperation.prototype.urlify = function(args) {
|
||||
if(param.paramType === 'query') {
|
||||
if(queryParams !== '')
|
||||
queryParams += "&";
|
||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
||||
if(args[param.name] !== undefined)
|
||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
||||
}
|
||||
}
|
||||
if ((queryParams != null) && queryParams.length > 0)
|
||||
@@ -976,7 +980,7 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
|
||||
}
|
||||
for (name in this.headers)
|
||||
myHeaders[name] = this.headers[name];
|
||||
if (requestContentType)
|
||||
if (requestContentType && body)
|
||||
myHeaders["Content-Type"] = requestContentType;
|
||||
if (responseContentType)
|
||||
myHeaders["Accept"] = responseContentType;
|
||||
@@ -1271,7 +1275,7 @@ ApiKeyAuthorization.prototype.apply = function(obj, authorizations) {
|
||||
if (obj.url.indexOf('?') > 0)
|
||||
obj.url = obj.url + "&" + this.name + "=" + this.value;
|
||||
else
|
||||
obj.url = obj.url + "?" + this.name + "=" + this.value;
|
||||
obj.url = obj.url + "?" + this.name + "=" + this.value;
|
||||
return true;
|
||||
} else if (this.type === "header") {
|
||||
obj.headers[this.name] = this.value;
|
||||
@@ -1287,11 +1291,10 @@ var PasswordAuthorization = function(name, username, password) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this._btoa = null;
|
||||
|
||||
if (typeof window !== 'undefined')
|
||||
return this._btoa = btoa;
|
||||
this._btoa = btoa;
|
||||
else
|
||||
return this._btoa = require("btoa");
|
||||
this._btoa = require("btoa");
|
||||
};
|
||||
|
||||
PasswordAuthorization.prototype.apply = function(obj, authorizations) {
|
||||
@@ -1304,6 +1307,8 @@ var e = (typeof window !== 'undefined' ? window : exports);
|
||||
e.SwaggerHttp = SwaggerHttp;
|
||||
e.SwaggerRequest = SwaggerRequest;
|
||||
e.authorizations = new SwaggerAuthorizations();
|
||||
e.ApiKeyAuthorization = ApiKeyAuthorization;
|
||||
e.PasswordAuthorization = PasswordAuthorization;
|
||||
e.JQueryHttpClient = JQueryHttpClient;
|
||||
e.ShredHttpClient = ShredHttpClient;
|
||||
e.SwaggerOperation = SwaggerOperation;
|
||||
|
||||
+22
-17
@@ -1,5 +1,5 @@
|
||||
// swagger.js
|
||||
// version 2.0.15
|
||||
// version 2.0.19
|
||||
|
||||
var __bind = function(fn, me){
|
||||
return function(){
|
||||
@@ -67,7 +67,7 @@ SwaggerApi.prototype.build = function() {
|
||||
}
|
||||
},
|
||||
response: function(resp) {
|
||||
var responseObj = resp.obj;
|
||||
var responseObj = resp.obj || JSON.parse(resp.data);
|
||||
_this.swaggerVersion = responseObj.swaggerVersion;
|
||||
if (_this.swaggerVersion === "1.2") {
|
||||
return _this.buildFromSpec(responseObj);
|
||||
@@ -284,8 +284,8 @@ var SwaggerResource = function(resourceObj, api) {
|
||||
accept: "application/json"
|
||||
},
|
||||
on: {
|
||||
response: function(response) {
|
||||
var responseObj = response.obj;
|
||||
response: function(resp) {
|
||||
var responseObj = resp.obj || JSON.parse(resp.data);
|
||||
return _this.addApiDeclaration(responseObj);
|
||||
},
|
||||
error: function(response) {
|
||||
@@ -478,11 +478,11 @@ SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
|
||||
if (!modelsToIgnore)
|
||||
modelsToIgnore = [];
|
||||
modelsToIgnore.push(this);
|
||||
modelsToIgnore.push(this.name);
|
||||
|
||||
for (var i = 0; i < this.properties.length; i++) {
|
||||
prop = this.properties[i];
|
||||
if ((prop.refModel != null) && modelsToIgnore.indexOf(prop.refModel) === -1) {
|
||||
if ((prop.refModel != null) && modelsToIgnore.indexOf(prop.refModel.name) === -1) {
|
||||
returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore));
|
||||
}
|
||||
}
|
||||
@@ -534,7 +534,7 @@ var SwaggerModelProperty = function(name, obj) {
|
||||
|
||||
SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) {
|
||||
var result;
|
||||
if ((this.refModel != null) && (modelsToIgnore[this.refModel.name] === undefined)) {
|
||||
if ((this.refModel != null) && (modelsToIgnore.indexOf(prop.refModel.name) === -1)) {
|
||||
result = this.refModel.createJSONSample(modelsToIgnore);
|
||||
} else {
|
||||
if (this.isCollection) {
|
||||
@@ -622,6 +622,9 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
|
||||
|
||||
// for 1.1 compatibility
|
||||
var type = param.type || param.dataType;
|
||||
if(type === 'array') {
|
||||
type = 'array[' + (param.items.$ref ? param.items.$ref : param.items.type) + ']';
|
||||
}
|
||||
|
||||
if(type.toLowerCase() === 'boolean') {
|
||||
param.allowableValues = {};
|
||||
@@ -636,7 +639,7 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
|
||||
param.allowableValues = {};
|
||||
param.allowableValues.descriptiveValues = [];
|
||||
|
||||
for(j = 0; j < enumValue.length; j++) {
|
||||
for(var j = 0; j < enumValue.length; j++) {
|
||||
var v = enumValue[j];
|
||||
if(param.defaultValue != null) {
|
||||
param.allowableValues.descriptiveValues.push ({
|
||||
@@ -652,7 +655,7 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
|
||||
}
|
||||
}
|
||||
}
|
||||
if(param.allowableValues != null) {
|
||||
else if(param.allowableValues != null) {
|
||||
if(param.allowableValues.valueType === "RANGE")
|
||||
param.isRange = true;
|
||||
else
|
||||
@@ -660,7 +663,7 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
|
||||
if(param.allowableValues != null) {
|
||||
param.allowableValues.descriptiveValues = [];
|
||||
if(param.allowableValues.values) {
|
||||
for(j = 0; j < param.allowableValues.values.length; j++){
|
||||
for(var j = 0; j < param.allowableValues.values.length; j++){
|
||||
var v = param.allowableValues.values[j];
|
||||
if(param.defaultValue != null) {
|
||||
param.allowableValues.descriptiveValues.push ({
|
||||
@@ -688,7 +691,7 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
|
||||
}
|
||||
|
||||
SwaggerOperation.prototype.isListType = function(type) {
|
||||
if (type.indexOf('[') >= 0) {
|
||||
if (type && type.indexOf('[') >= 0) {
|
||||
return type.substring(type.indexOf('[') + 1, type.indexOf(']'));
|
||||
} else {
|
||||
return void 0;
|
||||
@@ -828,7 +831,8 @@ SwaggerOperation.prototype.urlify = function(args) {
|
||||
if(param.paramType === 'query') {
|
||||
if(queryParams !== '')
|
||||
queryParams += "&";
|
||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
||||
if(args[param.name] !== undefined)
|
||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
||||
}
|
||||
}
|
||||
if ((queryParams != null) && queryParams.length > 0)
|
||||
@@ -976,7 +980,7 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
|
||||
}
|
||||
for (name in this.headers)
|
||||
myHeaders[name] = this.headers[name];
|
||||
if (requestContentType)
|
||||
if (requestContentType && body)
|
||||
myHeaders["Content-Type"] = requestContentType;
|
||||
if (responseContentType)
|
||||
myHeaders["Accept"] = responseContentType;
|
||||
@@ -1271,7 +1275,7 @@ ApiKeyAuthorization.prototype.apply = function(obj, authorizations) {
|
||||
if (obj.url.indexOf('?') > 0)
|
||||
obj.url = obj.url + "&" + this.name + "=" + this.value;
|
||||
else
|
||||
obj.url = obj.url + "?" + this.name + "=" + this.value;
|
||||
obj.url = obj.url + "?" + this.name + "=" + this.value;
|
||||
return true;
|
||||
} else if (this.type === "header") {
|
||||
obj.headers[this.name] = this.value;
|
||||
@@ -1287,11 +1291,10 @@ var PasswordAuthorization = function(name, username, password) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this._btoa = null;
|
||||
|
||||
if (typeof window !== 'undefined')
|
||||
return this._btoa = btoa;
|
||||
this._btoa = btoa;
|
||||
else
|
||||
return this._btoa = require("btoa");
|
||||
this._btoa = require("btoa");
|
||||
};
|
||||
|
||||
PasswordAuthorization.prototype.apply = function(obj, authorizations) {
|
||||
@@ -1304,6 +1307,8 @@ var e = (typeof window !== 'undefined' ? window : exports);
|
||||
e.SwaggerHttp = SwaggerHttp;
|
||||
e.SwaggerRequest = SwaggerRequest;
|
||||
e.authorizations = new SwaggerAuthorizations();
|
||||
e.ApiKeyAuthorization = ApiKeyAuthorization;
|
||||
e.PasswordAuthorization = PasswordAuthorization;
|
||||
e.JQueryHttpClient = JQueryHttpClient;
|
||||
e.ShredHttpClient = ShredHttpClient;
|
||||
e.SwaggerOperation = SwaggerOperation;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "swagger-ui",
|
||||
"version": "2.0.9",
|
||||
"version": "2.0.12",
|
||||
"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",
|
||||
@@ -19,7 +19,7 @@
|
||||
"readmeFilename": "README.md",
|
||||
"dependencies": {
|
||||
"coffee-script": "~1.5.0",
|
||||
"swagger-client": "2.0.14",
|
||||
"swagger-client": "2.0.19",
|
||||
"handlebars": "~1.0.10",
|
||||
"less": "~1.4.2"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user