This commit is contained in:
14
dist/lib/swagger.js
vendored
14
dist/lib/swagger.js
vendored
@@ -67,7 +67,7 @@ SwaggerApi.prototype.build = function() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
response: function(resp) {
|
response: function(resp) {
|
||||||
var responseObj = resp.obj;
|
var responseObj = resp.obj || JSON.parse(resp.data);
|
||||||
_this.swaggerVersion = responseObj.swaggerVersion;
|
_this.swaggerVersion = responseObj.swaggerVersion;
|
||||||
if (_this.swaggerVersion === "1.2") {
|
if (_this.swaggerVersion === "1.2") {
|
||||||
return _this.buildFromSpec(responseObj);
|
return _this.buildFromSpec(responseObj);
|
||||||
@@ -284,8 +284,8 @@ var SwaggerResource = function(resourceObj, api) {
|
|||||||
accept: "application/json"
|
accept: "application/json"
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
response: function(response) {
|
response: function(resp) {
|
||||||
var responseObj = response.obj;
|
var responseObj = resp.obj || JSON.parse(resp.data);
|
||||||
return _this.addApiDeclaration(responseObj);
|
return _this.addApiDeclaration(responseObj);
|
||||||
},
|
},
|
||||||
error: function(response) {
|
error: function(response) {
|
||||||
@@ -478,11 +478,11 @@ SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) {
|
|||||||
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
|
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
|
||||||
if (!modelsToIgnore)
|
if (!modelsToIgnore)
|
||||||
modelsToIgnore = [];
|
modelsToIgnore = [];
|
||||||
modelsToIgnore.push(this);
|
modelsToIgnore.push(this.name);
|
||||||
|
|
||||||
for (var i = 0; i < this.properties.length; i++) {
|
for (var i = 0; i < this.properties.length; i++) {
|
||||||
prop = this.properties[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));
|
returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -534,7 +534,7 @@ var SwaggerModelProperty = function(name, obj) {
|
|||||||
|
|
||||||
SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) {
|
SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) {
|
||||||
var result;
|
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);
|
result = this.refModel.createJSONSample(modelsToIgnore);
|
||||||
} else {
|
} else {
|
||||||
if (this.isCollection) {
|
if (this.isCollection) {
|
||||||
@@ -831,6 +831,7 @@ SwaggerOperation.prototype.urlify = function(args) {
|
|||||||
if(param.paramType === 'query') {
|
if(param.paramType === 'query') {
|
||||||
if(queryParams !== '')
|
if(queryParams !== '')
|
||||||
queryParams += "&";
|
queryParams += "&";
|
||||||
|
if(args[param.name] !== undefined)
|
||||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1307,6 +1308,7 @@ var e = (typeof window !== 'undefined' ? window : exports);
|
|||||||
e.SwaggerHttp = SwaggerHttp;
|
e.SwaggerHttp = SwaggerHttp;
|
||||||
e.SwaggerRequest = SwaggerRequest;
|
e.SwaggerRequest = SwaggerRequest;
|
||||||
e.authorizations = new SwaggerAuthorizations();
|
e.authorizations = new SwaggerAuthorizations();
|
||||||
|
e.ApiKeyAuthorization = ApiKeyAuthorization;
|
||||||
e.JQueryHttpClient = JQueryHttpClient;
|
e.JQueryHttpClient = JQueryHttpClient;
|
||||||
e.ShredHttpClient = ShredHttpClient;
|
e.ShredHttpClient = ShredHttpClient;
|
||||||
e.SwaggerOperation = SwaggerOperation;
|
e.SwaggerOperation = SwaggerOperation;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ SwaggerApi.prototype.build = function() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
response: function(resp) {
|
response: function(resp) {
|
||||||
var responseObj = resp.obj;
|
var responseObj = resp.obj || JSON.parse(resp.data);
|
||||||
_this.swaggerVersion = responseObj.swaggerVersion;
|
_this.swaggerVersion = responseObj.swaggerVersion;
|
||||||
if (_this.swaggerVersion === "1.2") {
|
if (_this.swaggerVersion === "1.2") {
|
||||||
return _this.buildFromSpec(responseObj);
|
return _this.buildFromSpec(responseObj);
|
||||||
@@ -284,8 +284,8 @@ var SwaggerResource = function(resourceObj, api) {
|
|||||||
accept: "application/json"
|
accept: "application/json"
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
response: function(response) {
|
response: function(resp) {
|
||||||
var responseObj = response.obj;
|
var responseObj = resp.obj || JSON.parse(resp.data);
|
||||||
return _this.addApiDeclaration(responseObj);
|
return _this.addApiDeclaration(responseObj);
|
||||||
},
|
},
|
||||||
error: function(response) {
|
error: function(response) {
|
||||||
@@ -478,11 +478,11 @@ SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) {
|
|||||||
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
|
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
|
||||||
if (!modelsToIgnore)
|
if (!modelsToIgnore)
|
||||||
modelsToIgnore = [];
|
modelsToIgnore = [];
|
||||||
modelsToIgnore.push(this);
|
modelsToIgnore.push(this.name);
|
||||||
|
|
||||||
for (var i = 0; i < this.properties.length; i++) {
|
for (var i = 0; i < this.properties.length; i++) {
|
||||||
prop = this.properties[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));
|
returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -534,7 +534,7 @@ var SwaggerModelProperty = function(name, obj) {
|
|||||||
|
|
||||||
SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) {
|
SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) {
|
||||||
var result;
|
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);
|
result = this.refModel.createJSONSample(modelsToIgnore);
|
||||||
} else {
|
} else {
|
||||||
if (this.isCollection) {
|
if (this.isCollection) {
|
||||||
@@ -831,6 +831,7 @@ SwaggerOperation.prototype.urlify = function(args) {
|
|||||||
if(param.paramType === 'query') {
|
if(param.paramType === 'query') {
|
||||||
if(queryParams !== '')
|
if(queryParams !== '')
|
||||||
queryParams += "&";
|
queryParams += "&";
|
||||||
|
if(args[param.name] !== undefined)
|
||||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1307,6 +1308,7 @@ var e = (typeof window !== 'undefined' ? window : exports);
|
|||||||
e.SwaggerHttp = SwaggerHttp;
|
e.SwaggerHttp = SwaggerHttp;
|
||||||
e.SwaggerRequest = SwaggerRequest;
|
e.SwaggerRequest = SwaggerRequest;
|
||||||
e.authorizations = new SwaggerAuthorizations();
|
e.authorizations = new SwaggerAuthorizations();
|
||||||
|
e.ApiKeyAuthorization = ApiKeyAuthorization;
|
||||||
e.JQueryHttpClient = JQueryHttpClient;
|
e.JQueryHttpClient = JQueryHttpClient;
|
||||||
e.ShredHttpClient = ShredHttpClient;
|
e.ShredHttpClient = ShredHttpClient;
|
||||||
e.SwaggerOperation = SwaggerOperation;
|
e.SwaggerOperation = SwaggerOperation;
|
||||||
|
|||||||
Reference in New Issue
Block a user