added response check for swagger 2.0/1.2 client
This commit is contained in:
@@ -184,6 +184,7 @@ var SwaggerClient = function(url, options) {
|
||||
this.basePath = null;
|
||||
this.authorizations = null;
|
||||
this.authorizationScheme = null;
|
||||
this.isValid = false;
|
||||
this.info = null;
|
||||
this.useJQuery = false;
|
||||
|
||||
@@ -236,6 +237,11 @@ SwaggerClient.prototype.build = function() {
|
||||
if(responseObj.swagger && responseObj.swagger === 2.0) {
|
||||
self.swaggerVersion = responseObj.swagger;
|
||||
self.buildFromSpec(responseObj);
|
||||
self.isValid = true;
|
||||
}
|
||||
else {
|
||||
self.isValid = false;
|
||||
self.failure()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ var SwaggerApi = function(url, options) {
|
||||
this.info = null;
|
||||
this.useJQuery = false;
|
||||
this.modelsArray = [];
|
||||
this.isValid;
|
||||
|
||||
options = (options||{});
|
||||
if (url)
|
||||
@@ -213,6 +214,7 @@ SwaggerApi.prototype.buildFromSpec = function(response) {
|
||||
this.apisArray.push(res);
|
||||
}
|
||||
}
|
||||
this.isValid = true;
|
||||
if (this.success) {
|
||||
this.success();
|
||||
}
|
||||
@@ -260,6 +262,7 @@ SwaggerApi.prototype.buildFrom1_1Spec = function(response) {
|
||||
this.apisArray.push(res);
|
||||
}
|
||||
}
|
||||
this.isValid = true;
|
||||
if (this.success) {
|
||||
this.success();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user