moved tests, added 1.x, 2.0
This commit is contained in:
26
dist/lib/swagger-client.js
vendored
26
dist/lib/swagger-client.js
vendored
@@ -379,9 +379,8 @@ SwaggerApi.prototype.buildFromSpec = function (response) {
|
||||
this.consumes = response.consumes;
|
||||
this.produces = response.produces;
|
||||
this.authSchemes = response.authorizations;
|
||||
if (response.info != null) {
|
||||
this.info = response.info;
|
||||
}
|
||||
this.info = this.convertInfo(response.info);
|
||||
|
||||
var isApi = false, i, res;
|
||||
for (i = 0; i < response.apis.length; i++) {
|
||||
var api = response.apis[i];
|
||||
@@ -429,9 +428,7 @@ SwaggerApi.prototype.buildFrom1_1Spec = function (response) {
|
||||
this.apis = {};
|
||||
this.apisArray = [];
|
||||
this.produces = response.produces;
|
||||
if (response.info != null) {
|
||||
this.info = response.info;
|
||||
}
|
||||
this.info = this.convertInfo(response.info);
|
||||
var isApi = false, res;
|
||||
for (var i = 0; i < response.apis.length; i++) {
|
||||
var api = response.apis[i];
|
||||
@@ -470,6 +467,23 @@ SwaggerApi.prototype.buildFrom1_1Spec = function (response) {
|
||||
return this;
|
||||
};
|
||||
|
||||
SwaggerApi.prototype.convertInfo = function (resp) {
|
||||
if(typeof resp == 'object') {
|
||||
var info = {}
|
||||
|
||||
info.title = resp.title;
|
||||
info.description = resp.description;
|
||||
info.termsOfService = resp.termsOfServiceUrl;
|
||||
info.contact = {};
|
||||
info.contact.name = resp.contact;
|
||||
info.license = {};
|
||||
info.license.name = resp.license;
|
||||
info.license.url = resp.licenseUrl;
|
||||
|
||||
return info;
|
||||
}
|
||||
};
|
||||
|
||||
SwaggerApi.prototype.selfReflect = function () {
|
||||
var resource, resource_name, ref;
|
||||
if (this.apis === null) {
|
||||
|
||||
Reference in New Issue
Block a user