moved tests, added 1.x, 2.0

This commit is contained in:
Tony Tam
2015-01-30 22:49:36 -08:00
parent 47e6ce540d
commit 89cb34ed1d
18 changed files with 2333 additions and 289 deletions

View File

@@ -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) {