updated version

This commit is contained in:
Tony Tam
2015-02-19 22:55:36 -08:00
parent 75bb7e2521
commit 1447b865d2
5 changed files with 212 additions and 196 deletions

View File

@@ -1,6 +1,6 @@
/**
* swagger-client - swagger.js is a javascript client for use with swaggering APIs.
* @version v2.1.6-M1
* @version v2.1.7-M1
* @link http://swagger.io
* @license apache 2.0
*/
@@ -1275,12 +1275,12 @@ var Model = function(name, definition) {
};
Model.prototype.createJSONSample = function(modelsToIgnore) {
var i, result = {};
var i, result = {}, representations = {};
modelsToIgnore = (modelsToIgnore||{});
modelsToIgnore[this.name] = this;
for (i = 0; i < this.properties.length; i++) {
prop = this.properties[i];
var sample = prop.getSampleValue(modelsToIgnore);
var sample = prop.getSampleValue(modelsToIgnore, representations);
result[prop.name] = sample;
}
delete modelsToIgnore[this.name];
@@ -1288,10 +1288,10 @@ Model.prototype.createJSONSample = function(modelsToIgnore) {
};
Model.prototype.getSampleValue = function(modelsToIgnore) {
var i, obj = {};
var i, obj = {}, representations = {};
for(i = 0; i < this.properties.length; i++ ) {
var property = this.properties[i];
obj[property.name] = property.sampleValue(false, modelsToIgnore);
obj[property.name] = property.sampleValue(false, modelsToIgnore, representations);
}
return obj;
};
@@ -1356,8 +1356,8 @@ var Property = function(name, obj, required) {
this.multipleOf = obj.multipleOf || null;
};
Property.prototype.getSampleValue = function (modelsToIgnore) {
return this.sampleValue(false, modelsToIgnore);
Property.prototype.getSampleValue = function (modelsToIgnore, representations) {
return this.sampleValue(false, modelsToIgnore, representations);
};
Property.prototype.isArray = function () {
@@ -1368,21 +1368,29 @@ Property.prototype.isArray = function () {
return false;
};
Property.prototype.sampleValue = function(isArray, ignoredModels) {
Property.prototype.sampleValue = function(isArray, ignoredModels, representations) {
isArray = (isArray || this.isArray());
ignoredModels = (ignoredModels || {});
// representations = (representations || {});
var type = getStringSignature(this.obj, true);
var output;
if(this.$ref) {
var refModelName = simpleRef(this.$ref);
var refModel = models[refModelName];
if(typeof representations[type] !== 'undefined') {
return representations[type];
}
else
if(refModel && typeof ignoredModels[type] === 'undefined') {
ignoredModels[type] = this;
output = refModel.getSampleValue(ignoredModels);
output = refModel.getSampleValue(ignoredModels, representations);
representations[type] = output;
}
else {
output = refModelName;
output = (representations[type] || refModelName);
}
}
else if(this.example)

344
dist/swagger-ui.js vendored
View File

@@ -395,27 +395,6 @@ Handlebars.registerHelper('sanitize', function(html) {
this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
return "<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>\n<div class='auth_container' id='basic_auth_container'>\n <div class='key_input_container'>\n <div class=\"auth_label\">Username</div>\n <input placeholder=\"username\" class=\"auth_input\" id=\"input_username\" name=\"username\" type=\"text\"/>\n <div class=\"auth_label\">Password</div>\n <input placeholder=\"password\" class=\"auth_input\" id=\"input_password\" name=\"password\" type=\"password\"/>\n <div class='auth_submit'><a class='auth_submit_button' id=\"apply_basic_auth\" href=\"#\">apply</a></div>\n </div>\n</div>\n\n";
},"useData":true});
this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"2":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, buffer = " <option value=\"";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
buffer += "\">";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
return buffer + "</option>\n";
},"4":function(depth0,helpers,partials,data) {
return " <option value=\"application/json\">application/json</option>\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, buffer = "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer + "</select>\n";
},"useData":true});
var ApiKeyButton,
__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;
@@ -469,6 +448,82 @@ ApiKeyButton = (function(_super) {
})(Backbone.View);
this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"2":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, buffer = " <option value=\"";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
buffer += "\">";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
return buffer + "</option>\n";
},"4":function(depth0,helpers,partials,data) {
return " <option value=\"application/json\">application/json</option>\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, buffer = "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer + "</select>\n";
},"useData":true});
var BasicAuthButton,
__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;
BasicAuthButton = (function(_super) {
__extends(BasicAuthButton, _super);
function BasicAuthButton() {
return BasicAuthButton.__super__.constructor.apply(this, arguments);
}
BasicAuthButton.prototype.initialize = function() {};
BasicAuthButton.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
return this;
};
BasicAuthButton.prototype.events = {
"click #basic_auth_button": "togglePasswordContainer",
"click #apply_basic_auth": "applyPassword"
};
BasicAuthButton.prototype.applyPassword = function() {
var elem, password, username;
username = $(".input_username").val();
password = $(".input_password").val();
window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
window.swaggerUi.load();
return elem = $('#basic_auth_container').hide();
};
BasicAuthButton.prototype.togglePasswordContainer = function() {
var elem;
if ($('#basic_auth_container').length > 0) {
elem = $('#basic_auth_container').show();
if (elem.is(':visible')) {
return elem.slideUp();
} else {
$('.auth_container').hide();
return elem.show();
}
}
};
BasicAuthButton.prototype.template = function() {
return Handlebars.templates.basic_auth_button_view;
};
return BasicAuthButton;
})(Backbone.View);
this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div class=\"info_title\">"
+ escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
@@ -552,58 +607,32 @@ this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(dept
if (stack1 != null) { buffer += stack1; }
return buffer + " </h4>\n </div>\n</div>\n";
},"useData":true});
var BasicAuthButton,
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;
BasicAuthButton = (function(_super) {
__extends(BasicAuthButton, _super);
ContentTypeView = (function(_super) {
__extends(ContentTypeView, _super);
function BasicAuthButton() {
return BasicAuthButton.__super__.constructor.apply(this, arguments);
function ContentTypeView() {
return ContentTypeView.__super__.constructor.apply(this, arguments);
}
BasicAuthButton.prototype.initialize = function() {};
ContentTypeView.prototype.initialize = function() {};
BasicAuthButton.prototype.render = 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;
};
BasicAuthButton.prototype.events = {
"click #basic_auth_button": "togglePasswordContainer",
"click #apply_basic_auth": "applyPassword"
ContentTypeView.prototype.template = function() {
return Handlebars.templates.content_type;
};
BasicAuthButton.prototype.applyPassword = function() {
var elem, password, username;
username = $(".input_username").val();
password = $(".input_password").val();
window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
window.swaggerUi.load();
return elem = $('#basic_auth_container').hide();
};
BasicAuthButton.prototype.togglePasswordContainer = function() {
var elem;
if ($('#basic_auth_container').length > 0) {
elem = $('#basic_auth_container').show();
if (elem.is(':visible')) {
return elem.slideUp();
} else {
$('.auth_container').hide();
return elem.show();
}
}
};
BasicAuthButton.prototype.template = function() {
return Handlebars.templates.basic_auth_button_view;
};
return BasicAuthButton;
return ContentTypeView;
})(Backbone.View);
@@ -710,35 +739,6 @@ this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function
if (stack1 != null) { buffer += stack1; }
return buffer + " </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\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"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
@@ -1682,35 +1682,6 @@ OperationView = (function(_super) {
})(Backbone.View);
var ParameterContentTypeView,
__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;
ParameterContentTypeView = (function(_super) {
__extends(ParameterContentTypeView, _super);
function ParameterContentTypeView() {
return ParameterContentTypeView.__super__.constructor.apply(this, arguments);
}
ParameterContentTypeView.prototype.initialize = function() {};
ParameterContentTypeView.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
$('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
return this;
};
ParameterContentTypeView.prototype.template = function() {
return Handlebars.templates.parameter_content_type;
};
return ParameterContentTypeView;
})(Backbone.View);
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 " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
@@ -1744,6 +1715,35 @@ this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template
if (stack1 != null) { buffer += stack1; }
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
},"useData":true});
var ParameterContentTypeView,
__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;
ParameterContentTypeView = (function(_super) {
__extends(ParameterContentTypeView, _super);
function ParameterContentTypeView() {
return ParameterContentTypeView.__super__.constructor.apply(this, arguments);
}
ParameterContentTypeView.prototype.initialize = function() {};
ParameterContentTypeView.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
$('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
return this;
};
ParameterContentTypeView.prototype.template = function() {
return Handlebars.templates.parameter_content_type;
};
return ParameterContentTypeView;
})(Backbone.View);
this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
@@ -2013,35 +2013,6 @@ ResourceView = (function(_super) {
})(Backbone.View);
var ResponseContentTypeView,
__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;
ResponseContentTypeView = (function(_super) {
__extends(ResponseContentTypeView, _super);
function ResponseContentTypeView() {
return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
}
ResponseContentTypeView.prototype.initialize = function() {};
ResponseContentTypeView.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
$('label[for=responseContentType]', $(this.el)).text('Response Content Type');
return this;
};
ResponseContentTypeView.prototype.template = function() {
return Handlebars.templates.response_content_type;
};
return ResponseContentTypeView;
})(Backbone.View);
this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
return " : ";
},"3":function(depth0,helpers,partials,data) {
@@ -2080,6 +2051,56 @@ this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(
+ escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
+ "_endpoint_list' style='display:none'>\n\n</ul>\n";
},"useData":true});
var ResponseContentTypeView,
__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;
ResponseContentTypeView = (function(_super) {
__extends(ResponseContentTypeView, _super);
function ResponseContentTypeView() {
return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
}
ResponseContentTypeView.prototype.initialize = function() {};
ResponseContentTypeView.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
$('label[for=responseContentType]', $(this.el)).text('Response Content Type');
return this;
};
ResponseContentTypeView.prototype.template = function() {
return Handlebars.templates.response_content_type;
};
return ResponseContentTypeView;
})(Backbone.View);
this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"2":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, buffer = " <option value=\"";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
buffer += "\">";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
return buffer + "</option>\n";
},"4":function(depth0,helpers,partials,data) {
return " <option value=\"application/json\">application/json</option>\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer + "</select>\n";
},"useData":true});
var SignatureView,
__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;
@@ -2152,26 +2173,13 @@ SignatureView = (function(_super) {
})(Backbone.View);
this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
this["Handlebars"]["templates"]["signature"] = Handlebars.template({"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 = "<div>\n<ul class=\"signature-nav\">\n <li><a class=\"description-link\" href=\"#\">Model</a></li>\n <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n ";
stack1 = ((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper));
if (stack1 != null) { buffer += stack1; }
return buffer;
},"2":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, buffer = " <option value=\"";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
buffer += "\">";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
return buffer + "</option>\n";
},"4":function(depth0,helpers,partials,data) {
return " <option value=\"application/json\">application/json</option>\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer + "</select>\n";
return buffer + "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"
+ escapeExpression(((helper = (helper = helpers.sampleJSON || (depth0 != null ? depth0.sampleJSON : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleJSON","hash":{},"data":data}) : helper)))
+ "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
},"useData":true});
var StatusCodeView,
__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; },
@@ -2215,14 +2223,6 @@ StatusCodeView = (function(_super) {
})(Backbone.View);
this["Handlebars"]["templates"]["signature"] = Handlebars.template({"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 = "<div>\n<ul class=\"signature-nav\">\n <li><a class=\"description-link\" href=\"#\">Model</a></li>\n <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n ";
stack1 = ((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper));
if (stack1 != null) { buffer += stack1; }
return buffer + "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"
+ escapeExpression(((helper = (helper = helpers.sampleJSON || (depth0 != null ? depth0.sampleJSON : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleJSON","hash":{},"data":data}) : helper)))
+ "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
},"useData":true});
this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"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 = "<td width='15%' class='code'>"
+ escapeExpression(((helper = (helper = helpers.code || (depth0 != null ? depth0.code : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"code","hash":{},"data":data}) : helper)))

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
/**
* swagger-client - swagger.js is a javascript client for use with swaggering APIs.
* @version v2.1.6-M1
* @version v2.1.7-M1
* @link http://swagger.io
* @license apache 2.0
*/
@@ -1275,12 +1275,12 @@ var Model = function(name, definition) {
};
Model.prototype.createJSONSample = function(modelsToIgnore) {
var i, result = {};
var i, result = {}, representations = {};
modelsToIgnore = (modelsToIgnore||{});
modelsToIgnore[this.name] = this;
for (i = 0; i < this.properties.length; i++) {
prop = this.properties[i];
var sample = prop.getSampleValue(modelsToIgnore);
var sample = prop.getSampleValue(modelsToIgnore, representations);
result[prop.name] = sample;
}
delete modelsToIgnore[this.name];
@@ -1288,10 +1288,10 @@ Model.prototype.createJSONSample = function(modelsToIgnore) {
};
Model.prototype.getSampleValue = function(modelsToIgnore) {
var i, obj = {};
var i, obj = {}, representations = {};
for(i = 0; i < this.properties.length; i++ ) {
var property = this.properties[i];
obj[property.name] = property.sampleValue(false, modelsToIgnore);
obj[property.name] = property.sampleValue(false, modelsToIgnore, representations);
}
return obj;
};
@@ -1356,8 +1356,8 @@ var Property = function(name, obj, required) {
this.multipleOf = obj.multipleOf || null;
};
Property.prototype.getSampleValue = function (modelsToIgnore) {
return this.sampleValue(false, modelsToIgnore);
Property.prototype.getSampleValue = function (modelsToIgnore, representations) {
return this.sampleValue(false, modelsToIgnore, representations);
};
Property.prototype.isArray = function () {
@@ -1368,21 +1368,29 @@ Property.prototype.isArray = function () {
return false;
};
Property.prototype.sampleValue = function(isArray, ignoredModels) {
Property.prototype.sampleValue = function(isArray, ignoredModels, representations) {
isArray = (isArray || this.isArray());
ignoredModels = (ignoredModels || {});
// representations = (representations || {});
var type = getStringSignature(this.obj, true);
var output;
if(this.$ref) {
var refModelName = simpleRef(this.$ref);
var refModel = models[refModelName];
if(typeof representations[type] !== 'undefined') {
return representations[type];
}
else
if(refModel && typeof ignoredModels[type] === 'undefined') {
ignoredModels[type] = this;
output = refModel.getSampleValue(ignoredModels);
output = refModel.getSampleValue(ignoredModels, representations);
representations[type] = output;
}
else {
output = refModelName;
output = (representations[type] || refModelName);
}
}
else if(this.example)

View File

@@ -2,7 +2,7 @@
"name": "swagger-ui",
"author": "Tony Tam <fehguy@gmail.com>",
"description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
"version": "2.1.5-M1",
"version": "2.1.6-M1",
"homepage": "http://swagger.io",
"license": "Apache 2.0",
"scripts": {
@@ -18,7 +18,7 @@
"dependencies": {
"shred": "0.8.10",
"btoa": "1.1.1",
"swagger-client": "2.1.6-M1"
"swagger-client": "2.1.7-M1"
},
"devDependencies": {
"chai": "^1.10.0",