diff --git a/dist/lib/swagger-client.js b/dist/lib/swagger-client.js
index 5745f5d8..02a283d9 100644
--- a/dist/lib/swagger-client.js
+++ b/dist/lib/swagger-client.js
@@ -1,6 +1,6 @@
/**
* swagger-client - swagger.js is a javascript client for use with swaggering APIs.
- * @version v2.1.2-M1
+ * @version v2.1.3-M1
* @link http://swagger.io
* @license apache 2.0
*/
@@ -82,10 +82,10 @@ SwaggerAuthorizations.prototype.remove = function(name) {
SwaggerAuthorizations.prototype.apply = function (obj, authorizations) {
var status = null;
- var key, value, result;
+ var key, name, value, result;
// if the "authorizations" key is undefined, or has an empty array, add all keys
- if (typeof authorizations === 'undefined' || Object.keys(authorizations).length == 0) {
+ if (typeof authorizations === 'undefined' || Object.keys(authorizations).length === 0) {
for (key in this.authz) {
value = this.authz[key];
result = value.apply(obj, authorizations);
@@ -280,6 +280,10 @@ PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) {
}
return returnVal;
};
+var addModel = function(name, model) {
+ models[name] = model;
+};
+
var SwaggerClient = function(url, options) {
this.isBuilt = false;
this.url = null;
@@ -387,7 +391,6 @@ SwaggerClient.prototype.build = function(mock) {
return obj;
new SwaggerHttp().execute(obj);
}
-
return this;
};
@@ -503,8 +506,11 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
}
}
this.isBuilt = true;
- if (this.success)
+ if (this.success) {
+ this.isValid = true;
+ this.isBuilt = true;
this.success();
+ }
return this;
};
@@ -593,18 +599,18 @@ var Operation = function(parent, scheme, operationId, httpMethod, path, args, de
}
}
+ var i, model;
+
if(definitions) {
// add to global models
var key;
for(key in this.definitions) {
- var model = new Model(key, definitions[key]);
+ model = new Model(key, definitions[key]);
if(model) {
models[key] = model;
}
}
}
-
- var i;
for(i = 0; i < this.parameters.length; i++) {
var param = this.parameters[i];
if(param.type === 'array') {
@@ -642,7 +648,7 @@ var Operation = function(parent, scheme, operationId, httpMethod, path, args, de
param.responseClassSignature = param.signature;
}
- var defaultResponseCode, response, model, responses = this.responses;
+ var defaultResponseCode, response, responses = this.responses;
if(responses['200']) {
response = responses['200'];
@@ -996,9 +1002,9 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
var allHeaders = this.getHeaderParams(args);
var contentTypeHeaders = this.setContentTypes(args, opts);
- var headers = {};
- for (var attrname in allHeaders) { headers[attrname] = allHeaders[attrname]; }
- for (var attrname in contentTypeHeaders) { headers[attrname] = contentTypeHeaders[attrname]; }
+ var headers = {}, attrname;
+ for (attrname in allHeaders) { headers[attrname] = allHeaders[attrname]; }
+ for (attrname in contentTypeHeaders) { headers[attrname] = contentTypeHeaders[attrname]; }
var body = this.getBody(headers, args);
var url = this.urlify(args);
@@ -1440,7 +1446,7 @@ Property.prototype.toString = function() {
type = '';
}
else {
- this.schema.type;
+ type = this.schema.type;
}
if (this.default)
@@ -1501,7 +1507,7 @@ Property.prototype.toString = function() {
optionHtml = function(label, value) {
return '
| ' + label + ': | ' + value + ' |
';
-}
+};
typeFromJsonSchema = function(type, format) {
var str;
@@ -1534,7 +1540,7 @@ var cookies = {};
var models = {};
SwaggerClient.prototype.buildFrom1_2Spec = function (response) {
- if (response.apiVersion != null) {
+ if (response.apiVersion !== null) {
this.apiVersion = response.apiVersion;
}
this.apis = {};
@@ -1584,15 +1590,16 @@ SwaggerClient.prototype.buildFrom1_2Spec = function (response) {
SwaggerClient.prototype.finish = function() {
if (typeof this.success === 'function') {
- console.log('success');
+ this.isValid = true;
+ this.isBuilt = true;
this.selfReflect();
this.success();
}
-}
+};
SwaggerClient.prototype.buildFrom1_1Spec = function (response) {
log('This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info');
- if (response.apiVersion != null)
+ if (response.apiVersion !== null)
this.apiVersion = response.apiVersion;
this.apis = {};
this.apisArray = [];
@@ -1638,7 +1645,7 @@ SwaggerClient.prototype.buildFrom1_1Spec = function (response) {
SwaggerClient.prototype.convertInfo = function (resp) {
if(typeof resp == 'object') {
- var info = {}
+ var info = {};
info.title = resp.title;
info.description = resp.description;
@@ -1667,9 +1674,6 @@ SwaggerClient.prototype.selfReflect = function () {
}
this.setConsolidatedModels();
this.ready = true;
- if (typeof this.success === 'function') {
- return this.success();
- }
};
SwaggerClient.prototype.setConsolidatedModels = function () {
@@ -2088,7 +2092,7 @@ var SwaggerOperation = function (nickname, path, method, parameters, summary, no
this.path = this.path.replace('{format}', 'json');
this.method = this.method.toLowerCase();
- this.isGetMethod = this.method === 'GET';
+ this.isGetMethod = this.method === 'get';
var i, j, v;
this.resourceName = this.resource.name;
@@ -2139,17 +2143,17 @@ var SwaggerOperation = function (nickname, path, method, parameters, summary, no
}
}
}
- else if (param.allowableValues != null) {
+ else if (param.allowableValues) {
if (param.allowableValues.valueType === 'RANGE')
param.isRange = true;
else
param.isList = true;
- if (param.allowableValues != null) {
+ if (param.allowableValues) {
param.allowableValues.descriptiveValues = [];
if (param.allowableValues.values) {
for (j = 0; j < param.allowableValues.values.length; j++) {
v = param.allowableValues.values[j];
- if (param.defaultValue != null) {
+ if (param.defaultValue !== null) {
param.allowableValues.descriptiveValues.push({
value: String(v),
isDefault: (v === param.defaultValue)
@@ -2219,7 +2223,7 @@ SwaggerOperation.prototype.getSampleJSON = function (type, models) {
var isPrimitive, listType, val;
listType = this.isListType(type);
isPrimitive = ((typeof listType !== 'undefined') && models[listType]) || (typeof models[type] !== 'undefined') ? false : true;
- val = isPrimitive ? void 0 : (listType != null ? models[listType].createJSONSample() : models[type].createJSONSample());
+ val = isPrimitive ? void 0 : (listType ? models[listType].createJSONSample() : models[type].createJSONSample());
if (val) {
val = listType ? [val] : val;
if (typeof val == 'string')
@@ -2254,7 +2258,7 @@ SwaggerOperation.prototype['do'] = function (args, opts, callback, error) {
callback = function (response) {
var content;
content = null;
- if (response != null) {
+ if (response !== null) {
content = response.data;
} else {
content = 'no data';
@@ -2265,7 +2269,7 @@ SwaggerOperation.prototype['do'] = function (args, opts, callback, error) {
params = {};
params.headers = [];
- if (args.headers != null) {
+ if (args.headers) {
params.headers = args.headers;
delete args.headers;
}
@@ -2386,7 +2390,7 @@ SwaggerOperation.prototype.urlify = function (args) {
}
}
}
- if ((queryParams != null) && queryParams.length > 0)
+ if ((queryParams) && queryParams.length > 0)
url += '?' + queryParams;
return url;
};
@@ -2595,7 +2599,7 @@ var SwaggerRequest = function (type, url, params, opts, successCallback, errorCa
}
var obj;
- if (!((this.headers != null) && (this.headers.mock != null))) {
+ if (!((this.headers) && (this.headers.mock))) {
obj = {
url: this.url,
method: this.type,
@@ -2964,7 +2968,9 @@ e.ApiKeyAuthorization = ApiKeyAuthorization;
e.PasswordAuthorization = PasswordAuthorization;
e.CookieAuthorization = CookieAuthorization;
e.SwaggerClient = SwaggerClient;
+e.SwaggerApi = SwaggerClient;
e.Operation = Operation;
e.Model = Model;
-e.models = models;
+e.addModel = addModel;
+
})();
\ No newline at end of file
diff --git a/dist/swagger-ui.js b/dist/swagger-ui.js
index 087cf6c9..ccf10c32 100644
--- a/dist/swagger-ui.js
+++ b/dist/swagger-ui.js
@@ -1,6 +1,6 @@
/**
* swagger-ui - Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API
- * @version v2.1.2-M1
+ * @version v2.1.3-M1
* @link http://swagger.io
* @license Apache 2.0
*/
@@ -237,7 +237,6 @@ SwaggerUi = (function(_super) {
this.options = options;
this.options.success = (function(_this) {
return function() {
- console.log('rendering');
return _this.render();
};
})(this);
@@ -614,35 +613,6 @@ this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(dept
if (stack1 != null) { buffer += stack1; }
return buffer + " \n \n\n";
},"useData":true});
-var ContentTypeView,
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
- __hasProp = {}.hasOwnProperty;
-
-ContentTypeView = (function(_super) {
- __extends(ContentTypeView, _super);
-
- function ContentTypeView() {
- return ContentTypeView.__super__.constructor.apply(this, arguments);
- }
-
- ContentTypeView.prototype.initialize = function() {};
-
- ContentTypeView.prototype.render = function() {
- var template;
- template = this.template();
- $(this.el).html(template(this.model));
- $('label[for=contentType]', $(this.el)).text('Response Content Type');
- return this;
- };
-
- ContentTypeView.prototype.template = function() {
- return Handlebars.templates.content_type;
- };
-
- return ContentTypeView;
-
-})(Backbone.View);
-
this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
return "deprecated";
},"3":function(depth0,helpers,partials,data) {
@@ -746,68 +716,32 @@ this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function
if (stack1 != null) { buffer += stack1; }
return buffer + " \n \n
Request URL
\n
\n
Response Body
\n
\n
Response Code
\n
\n
Response Headers
\n \n
\n \n \n \n";
},"useData":true});
-var HeaderView,
+var ContentTypeView,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__hasProp = {}.hasOwnProperty;
-HeaderView = (function(_super) {
- __extends(HeaderView, _super);
+ContentTypeView = (function(_super) {
+ __extends(ContentTypeView, _super);
- function HeaderView() {
- return HeaderView.__super__.constructor.apply(this, arguments);
+ function ContentTypeView() {
+ return ContentTypeView.__super__.constructor.apply(this, arguments);
}
- HeaderView.prototype.events = {
- 'click #show-pet-store-icon': 'showPetStore',
- 'click #show-wordnik-dev-icon': 'showWordnikDev',
- 'click #explore': 'showCustom',
- 'keyup #input_baseUrl': 'showCustomOnKeyup',
- 'keyup #input_apiKey': 'showCustomOnKeyup'
+ ContentTypeView.prototype.initialize = function() {};
+
+ ContentTypeView.prototype.render = function() {
+ var template;
+ template = this.template();
+ $(this.el).html(template(this.model));
+ $('label[for=contentType]', $(this.el)).text('Response Content Type');
+ return this;
};
- HeaderView.prototype.initialize = function() {};
-
- HeaderView.prototype.showPetStore = function(e) {
- return this.trigger('update-swagger-ui', {
- url: "http://petstore.swagger.wordnik.com/api/api-docs"
- });
+ ContentTypeView.prototype.template = function() {
+ return Handlebars.templates.content_type;
};
- HeaderView.prototype.showWordnikDev = function(e) {
- return this.trigger('update-swagger-ui', {
- url: "http://api.wordnik.com/v4/resources.json"
- });
- };
-
- HeaderView.prototype.showCustomOnKeyup = function(e) {
- if (e.keyCode === 13) {
- return this.showCustom();
- }
- };
-
- HeaderView.prototype.showCustom = function(e) {
- if (e != null) {
- e.preventDefault();
- }
- return this.trigger('update-swagger-ui', {
- url: $('#input_baseUrl').val(),
- apiKey: $('#input_apiKey').val()
- });
- };
-
- HeaderView.prototype.update = function(url, apiKey, trigger) {
- if (trigger == null) {
- trigger = false;
- }
- $('#input_baseUrl').val(url);
- if (trigger) {
- return this.trigger('update-swagger-ui', {
- url: url
- });
- }
- };
-
- return HeaderView;
+ return ContentTypeView;
})(Backbone.View);
@@ -874,6 +808,127 @@ this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(dep
if (stack1 != null) { buffer += stack1; }
return buffer + "\n\n \n | \n";
},"useData":true});
+var HeaderView,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+HeaderView = (function(_super) {
+ __extends(HeaderView, _super);
+
+ function HeaderView() {
+ return HeaderView.__super__.constructor.apply(this, arguments);
+ }
+
+ HeaderView.prototype.events = {
+ 'click #show-pet-store-icon': 'showPetStore',
+ 'click #show-wordnik-dev-icon': 'showWordnikDev',
+ 'click #explore': 'showCustom',
+ 'keyup #input_baseUrl': 'showCustomOnKeyup',
+ 'keyup #input_apiKey': 'showCustomOnKeyup'
+ };
+
+ HeaderView.prototype.initialize = function() {};
+
+ HeaderView.prototype.showPetStore = function(e) {
+ return this.trigger('update-swagger-ui', {
+ url: "http://petstore.swagger.wordnik.com/api/api-docs"
+ });
+ };
+
+ HeaderView.prototype.showWordnikDev = function(e) {
+ return this.trigger('update-swagger-ui', {
+ url: "http://api.wordnik.com/v4/resources.json"
+ });
+ };
+
+ HeaderView.prototype.showCustomOnKeyup = function(e) {
+ if (e.keyCode === 13) {
+ return this.showCustom();
+ }
+ };
+
+ HeaderView.prototype.showCustom = function(e) {
+ if (e != null) {
+ e.preventDefault();
+ }
+ return this.trigger('update-swagger-ui', {
+ url: $('#input_baseUrl').val(),
+ apiKey: $('#input_apiKey').val()
+ });
+ };
+
+ HeaderView.prototype.update = function(url, apiKey, trigger) {
+ if (trigger == null) {
+ trigger = false;
+ }
+ $('#input_baseUrl').val(url);
+ if (trigger) {
+ return this.trigger('update-swagger-ui', {
+ url: url
+ });
+ }
+ };
+
+ return HeaderView;
+
+})(Backbone.View);
+
+this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+ return " multiple='multiple'";
+ },"3":function(depth0,helpers,partials,data) {
+ return "";
+},"5":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(6, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"6":function(depth0,helpers,partials,data) {
+ var stack1, helperMissing=helpers.helperMissing, buffer = "";
+ stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.program(7, data),"data":data}));
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"7":function(depth0,helpers,partials,data) {
+ return " \n";
+ },"9":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"10":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " \n";
+},"12":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " \n";
+},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = ""
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + " | \n\n \n | \n";
+ stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ buffer += " | \n";
+ stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + " | \n | ";
+},"useData":true});
var MainView,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__hasProp = {}.hasOwnProperty;
@@ -987,61 +1042,38 @@ MainView = (function(_super) {
})(Backbone.View);
-this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
- return " multiple='multiple'";
- },"3":function(depth0,helpers,partials,data) {
- return "";
-},"5":function(depth0,helpers,partials,data) {
+this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " \n";
+},"3":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(6, data),"data":data});
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
+},"4":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " "
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
+ + "\n";
},"6":function(depth0,helpers,partials,data) {
- var stack1, helperMissing=helpers.helperMissing, buffer = "";
- stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.program(7, data),"data":data}));
- if (stack1 != null) { buffer += stack1; }
- return buffer;
-},"7":function(depth0,helpers,partials,data) {
- return " \n";
- },"9":function(depth0,helpers,partials,data) {
- var stack1, buffer = "";
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
- if (stack1 != null) { buffer += stack1; }
- return buffer;
-},"10":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return " \n";
-},"12":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return " \n";
-},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ return " (empty)\n";
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = ""
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
- + " | \n\n | \n | \n";
},"useData":true});
var OperationView,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
@@ -1656,9 +1688,9 @@ OperationView = (function(_super) {
})(Backbone.View);
-this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return "