updated js client
This commit is contained in:
22
dist/lib/swagger-client.js
vendored
22
dist/lib/swagger-client.js
vendored
@@ -1,5 +1,5 @@
|
|||||||
// swagger-client.js
|
// swagger-client.js
|
||||||
// version 2.1.0-alpha.1
|
// version 2.1.0-alpha.2
|
||||||
/**
|
/**
|
||||||
* Array Model
|
* Array Model
|
||||||
**/
|
**/
|
||||||
@@ -375,7 +375,8 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
|
|||||||
this.info = response.info || {};
|
this.info = response.info || {};
|
||||||
this.title = response.title || '';
|
this.title = response.title || '';
|
||||||
this.host = response.host || '';
|
this.host = response.host || '';
|
||||||
this.schemes = response.schemes || [ 'http' ];
|
this.schemes = response.schemes || [];
|
||||||
|
this.scheme;
|
||||||
this.basePath = response.basePath || '';
|
this.basePath = response.basePath || '';
|
||||||
this.apis = {};
|
this.apis = {};
|
||||||
this.apisArray = [];
|
this.apisArray = [];
|
||||||
@@ -383,9 +384,19 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
|
|||||||
this.produces = response.produces;
|
this.produces = response.produces;
|
||||||
this.authSchemes = response.authorizations;
|
this.authSchemes = response.authorizations;
|
||||||
|
|
||||||
if(typeof this.host === 'undefined' || this.host === '') {
|
|
||||||
var location = this.parseUri(this.url);
|
var location = this.parseUri(this.url);
|
||||||
|
if(typeof this.schemes === 'undefined' || this.schemes.length === 0) {
|
||||||
|
this.scheme = location.scheme;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.scheme = this.schemes[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(typeof this.host === 'undefined' || this.host === '') {
|
||||||
this.host = location.host;
|
this.host = location.host;
|
||||||
|
if (location.port) {
|
||||||
|
this.host = this.host + ':' + location.port;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.definitions = response.definitions;
|
this.definitions = response.definitions;
|
||||||
@@ -466,6 +477,7 @@ SwaggerClient.prototype.parseUri = function(uri) {
|
|||||||
return {
|
return {
|
||||||
scheme: parts[4].replace(':',''),
|
scheme: parts[4].replace(':',''),
|
||||||
host: parts[11],
|
host: parts[11],
|
||||||
|
port: parts[12],
|
||||||
path: parts[15]
|
path: parts[15]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -516,6 +528,7 @@ var Operation = function(parent, operationId, httpMethod, path, args, definition
|
|||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.host = parent.host;
|
this.host = parent.host;
|
||||||
this.schemes = parent.schemes;
|
this.schemes = parent.schemes;
|
||||||
|
this.scheme = parent.scheme || 'http';
|
||||||
this.basePath = parent.basePath;
|
this.basePath = parent.basePath;
|
||||||
this.nickname = (operationId||errors.push('Operations must have a nickname.'));
|
this.nickname = (operationId||errors.push('Operations must have a nickname.'));
|
||||||
this.method = (httpMethod||errors.push('Operation ' + operationId + ' is missing method.'));
|
this.method = (httpMethod||errors.push('Operation ' + operationId + ' is missing method.'));
|
||||||
@@ -851,8 +864,7 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
|||||||
// todo append?
|
// todo append?
|
||||||
args.body = encoded;
|
args.body = encoded;
|
||||||
}
|
}
|
||||||
var scheme = this.schemes[0];
|
var url = this.scheme + '://' + this.host + this.basePath + requestUrl + querystring;
|
||||||
var url = scheme + '://' + this.host + this.basePath + requestUrl + querystring;
|
|
||||||
|
|
||||||
var obj = {
|
var obj = {
|
||||||
url: url,
|
url: url,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// swagger-client.js
|
// swagger-client.js
|
||||||
// version 2.1.0-alpha.1
|
// version 2.1.0-alpha.2
|
||||||
/**
|
/**
|
||||||
* Array Model
|
* Array Model
|
||||||
**/
|
**/
|
||||||
@@ -375,7 +375,8 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
|
|||||||
this.info = response.info || {};
|
this.info = response.info || {};
|
||||||
this.title = response.title || '';
|
this.title = response.title || '';
|
||||||
this.host = response.host || '';
|
this.host = response.host || '';
|
||||||
this.schemes = response.schemes || [ 'http' ];
|
this.schemes = response.schemes || [];
|
||||||
|
this.scheme;
|
||||||
this.basePath = response.basePath || '';
|
this.basePath = response.basePath || '';
|
||||||
this.apis = {};
|
this.apis = {};
|
||||||
this.apisArray = [];
|
this.apisArray = [];
|
||||||
@@ -383,9 +384,19 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
|
|||||||
this.produces = response.produces;
|
this.produces = response.produces;
|
||||||
this.authSchemes = response.authorizations;
|
this.authSchemes = response.authorizations;
|
||||||
|
|
||||||
if(typeof this.host === 'undefined' || this.host === '') {
|
|
||||||
var location = this.parseUri(this.url);
|
var location = this.parseUri(this.url);
|
||||||
|
if(typeof this.schemes === 'undefined' || this.schemes.length === 0) {
|
||||||
|
this.scheme = location.scheme;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.scheme = this.schemes[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(typeof this.host === 'undefined' || this.host === '') {
|
||||||
this.host = location.host;
|
this.host = location.host;
|
||||||
|
if (location.port) {
|
||||||
|
this.host = this.host + ':' + location.port;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.definitions = response.definitions;
|
this.definitions = response.definitions;
|
||||||
@@ -466,6 +477,7 @@ SwaggerClient.prototype.parseUri = function(uri) {
|
|||||||
return {
|
return {
|
||||||
scheme: parts[4].replace(':',''),
|
scheme: parts[4].replace(':',''),
|
||||||
host: parts[11],
|
host: parts[11],
|
||||||
|
port: parts[12],
|
||||||
path: parts[15]
|
path: parts[15]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -516,6 +528,7 @@ var Operation = function(parent, operationId, httpMethod, path, args, definition
|
|||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.host = parent.host;
|
this.host = parent.host;
|
||||||
this.schemes = parent.schemes;
|
this.schemes = parent.schemes;
|
||||||
|
this.scheme = parent.scheme || 'http';
|
||||||
this.basePath = parent.basePath;
|
this.basePath = parent.basePath;
|
||||||
this.nickname = (operationId||errors.push('Operations must have a nickname.'));
|
this.nickname = (operationId||errors.push('Operations must have a nickname.'));
|
||||||
this.method = (httpMethod||errors.push('Operation ' + operationId + ' is missing method.'));
|
this.method = (httpMethod||errors.push('Operation ' + operationId + ' is missing method.'));
|
||||||
@@ -851,8 +864,7 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
|||||||
// todo append?
|
// todo append?
|
||||||
args.body = encoded;
|
args.body = encoded;
|
||||||
}
|
}
|
||||||
var scheme = this.schemes[0];
|
var url = this.scheme + '://' + this.host + this.basePath + requestUrl + querystring;
|
||||||
var url = scheme + '://' + this.host + this.basePath + requestUrl + querystring;
|
|
||||||
|
|
||||||
var obj = {
|
var obj = {
|
||||||
url: url,
|
url: url,
|
||||||
|
|||||||
Reference in New Issue
Block a user