added support for swagger-spec 1.2
This commit is contained in:
12
dist/lib/swagger.js
vendored
12
dist/lib/swagger.js
vendored
@@ -63,7 +63,11 @@
|
||||
}
|
||||
_this.basePath = _this.basePath.replace(/\/$/, '');
|
||||
} else {
|
||||
_this.basePath = _this.discoveryUrl.substring(0, _this.discoveryUrl.lastIndexOf('/'));
|
||||
if (_this.discoveryUrl.indexOf('?') > 0) {
|
||||
_this.basePath = _this.discoveryUrl.substring(0, _this.discoveryUrl.lastIndexOf('?'));
|
||||
} else {
|
||||
_this.basePath = _this.discoveryUrl;
|
||||
}
|
||||
log('derived basepath from discoveryUrl as ' + _this.basePath);
|
||||
}
|
||||
_this.apis = {};
|
||||
@@ -201,6 +205,7 @@
|
||||
parts = this.path.split("/");
|
||||
this.name = parts[parts.length - 1].replace('.{format}', '');
|
||||
this.basePath = this.api.basePath;
|
||||
console.log('bp: ' + this.basePath);
|
||||
this.operations = {};
|
||||
this.operationsArray = [];
|
||||
this.modelsArray = [];
|
||||
@@ -215,6 +220,8 @@
|
||||
this.api.fail("SwaggerResources must have a path.");
|
||||
}
|
||||
this.url = this.api.suffixApiKey(this.api.basePath + this.path.replace('{format}', 'json'));
|
||||
console.log('basePath: ' + this.api.basePath);
|
||||
console.log('url: ' + this.url);
|
||||
this.api.progress('fetching resource ' + this.name + ': ' + this.url);
|
||||
jQuery.getJSON(this.url, function(response) {
|
||||
var endpoint, _i, _len, _ref;
|
||||
@@ -279,6 +286,9 @@
|
||||
if (o.errorResponses) {
|
||||
errorResponses = o.errorResponses;
|
||||
}
|
||||
if (o.method) {
|
||||
o.httpMethod = o.method;
|
||||
}
|
||||
op = new SwaggerOperation(o.nickname, resource_path, o.httpMethod, o.parameters, o.summary, o.notes, o.responseClass, errorResponses, this, o.consumes, o.produces);
|
||||
this.operations[op.nickname] = op;
|
||||
_results.push(this.operationsArray.push(op));
|
||||
|
||||
Reference in New Issue
Block a user