Merge pull request #901 from swagger-api/issue-899

added operation type checking, write header to library, updated client library
This commit is contained in:
Tony Tam
2015-02-02 20:21:20 -08:00
6 changed files with 397 additions and 339 deletions

View File

@@ -1,6 +1,6 @@
/**
* swagger-client - swagger.js is a javascript client for use with swaggering APIs.
* @version v2.1.0-M1
* @version v2.1.1-M1
* @link http://swagger.io
* @license apache 2.0
*/
@@ -31,7 +31,13 @@ ArrayModel.prototype.createJSONSample = function(modelsToIgnore) {
}
else if (this.ref) {
var name = simpleRef(this.ref);
result = models[name].createJSONSample();
if(typeof modelsToIgnore[name] === 'undefined') {
modelsToIgnore[name] = this;
result = models[name].createJSONSample(modelsToIgnore);
}
else {
return name;
}
}
return [ result ];
};
@@ -90,6 +96,7 @@ SwaggerAuthorizations.prototype.apply = function (obj, authorizations) {
else {
// 2.0 support
if (Array.isArray(authorizations)) {
for (var i = 0; i < authorizations.length; i++) {
var auth = authorizations[i];
for (name in auth) {
@@ -607,12 +614,15 @@ var Operation = function(parent, scheme, operationId, httpMethod, path, args, de
param.allowableValues.descriptiveValues.push({value : value, isDefault: isDefault});
}
}
if(param.type === 'array' && typeof param.allowableValues === 'undefined') {
// can't show as a list if no values to select from
delete param.isList;
delete param.allowMultiple;
if(param.type === 'array') {
innerType = [innerType];
if(typeof param.allowableValues === 'undefined') {
// can't show as a list if no values to select from
delete param.isList;
delete param.allowMultiple;
}
}
param.signature = this.getModelSignature(innerType, models);
param.signature = this.getModelSignature(innerType, models).toString();
param.sampleJSON = this.getModelSampleJSON(innerType, models);
param.responseClassSignature = param.signature;
}
@@ -764,16 +774,21 @@ Operation.prototype.getModelSignature = function(type, definitions) {
listType = true;
type = type[0];
}
else if(typeof type === 'undefined')
type = 'undefined';
if(type === 'string')
isPrimitive = true;
else
isPrimitive = (listType && definitions[listType]) || (definitions[type]) ? false : true;
if (isPrimitive) {
return type;
if(listType)
return 'Array[' + type + ']';
else
return type.toString();
} else {
if (listType)
return definitions[type].getMockSignature();
return 'Array[' + definitions[type].getMockSignature() + ']';
else
return definitions[type].getMockSignature();
}
@@ -965,8 +980,13 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
fail(message);
return;
}
var headers = this.getHeaderParams(args);
headers = this.setContentTypes(args, opts);
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 body = this.getBody(headers, args);
var url = this.urlify(args);
@@ -1013,10 +1033,10 @@ Operation.prototype.setContentTypes = function(args, opts) {
else
definedFormParams.push(param);
}
else if(param.in === 'header' && this.headers) {
else if(param.in === 'header' && opts) {
var key = param.name;
var headerValue = this.headers[param.name];
if(typeof this.headers[param.name] !== 'undefined')
var headerValue = opts[param.name];
if(typeof opts[param.name] !== 'undefined')
headers[key] = headerValue;
}
else if(param.in === 'body' && typeof args[param.name] !== 'undefined') {
@@ -1184,21 +1204,20 @@ var Model = function(name, definition) {
};
Model.prototype.createJSONSample = function(modelsToIgnore) {
var result = {};
var i, result = {};
modelsToIgnore = (modelsToIgnore||{});
modelsToIgnore[this.name] = this;
var i;
for (i = 0; i < this.properties.length; i++) {
prop = this.properties[i];
result[prop.name] = prop.getSampleValue(modelsToIgnore);
var sample = prop.getSampleValue(modelsToIgnore);
result[prop.name] = sample;
}
delete modelsToIgnore[this.name];
return result;
};
Model.prototype.getSampleValue = function(modelsToIgnore) {
var i;
var obj = {};
var i, obj = {};
for(i = 0; i < this.properties.length; i++ ) {
var property = this.properties[i];
obj[property.name] = property.sampleValue(false, modelsToIgnore);
@@ -1207,8 +1226,7 @@ Model.prototype.getSampleValue = function(modelsToIgnore) {
};
Model.prototype.getMockSignature = function(modelsToIgnore) {
var propertiesStr = [];
var i, prop;
var i, prop, propertiesStr = [];
for (i = 0; i < this.properties.length; i++) {
prop = this.properties[i];
propertiesStr.push(prop.toString());
@@ -1282,7 +1300,7 @@ Property.prototype.isArray = function () {
Property.prototype.sampleValue = function(isArray, ignoredModels) {
isArray = (isArray || this.isArray());
ignoredModels = (ignoredModels || {});
var type = getStringSignature(this.obj);
var type = getStringSignature(this.obj, true);
var output;
if(this.$ref) {
@@ -1292,8 +1310,9 @@ Property.prototype.sampleValue = function(isArray, ignoredModels) {
ignoredModels[type] = this;
output = refModel.getSampleValue(ignoredModels);
}
else
type = refModel;
else {
output = refModelName;
}
}
else if(this.example)
output = this.example;
@@ -1324,16 +1343,20 @@ Property.prototype.sampleValue = function(isArray, ignoredModels) {
return output;
};
getStringSignature = function(obj) {
getStringSignature = function(obj, baseComponent) {
var str = '';
if(typeof obj.$ref !== 'undefined')
str += simpleRef(obj.$ref);
else if(typeof obj.type === 'undefined')
str += 'object';
else if(obj.type === 'array') {
str += 'Array[';
str += getStringSignature((obj.items || obj.$ref || {}));
str += ']';
if(baseComponent)
str += getStringSignature((obj.items || obj.$ref || {}));
else {
str += 'Array[';
str += getStringSignature((obj.items || obj.$ref || {}));
str += ']';
}
}
else if(obj.type === 'integer' && obj.format === 'int32')
str += 'integer';

569
dist/swagger-ui.js vendored
View File

@@ -1,3 +1,9 @@
/**
* 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.1-M1
* @link http://swagger.io
* @license Apache 2.0
*/
$(function() {
// Helper function for vertically aligning DOM elements
@@ -222,6 +228,9 @@ SwaggerUi = (function(_super) {
this.dom_id = options.dom_id;
delete options.dom_id;
}
if (options.supportedSubmitMethods == null) {
options.supportedSubmitMethods = ['get', 'put', 'post', 'delete', 'head', 'options', 'patch'];
}
if ($('#' + this.dom_id) == null) {
$('body').append('<div id="' + this.dom_id + '"></div>');
}
@@ -605,35 +614,6 @@ 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 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) {
@@ -737,68 +717,32 @@ 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 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);
@@ -865,6 +809,127 @@ this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(dep
if (stack1 != null) { buffer += stack1; }
return buffer + "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\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 " <option selected=\"\" value=''></option>\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 " <option selected=\"\" value='"
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
+ "'>"
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
+ " (default)</option>\n";
},"12":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <option value='"
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
+ "'>"
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
+ "</option>\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 = "<td class='code'>"
+ 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)))
+ "</td>\n<td>\n <select ";
stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
if (stack1 != null) { buffer += stack1; }
buffer += " class='parameter' name='"
+ 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";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(5, data),"data":data});
if (stack1 != null) { buffer += stack1; }
stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
if (stack1 != null) { buffer += stack1; }
buffer += " </select>\n</td>\n<td class=\"markdown\">";
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 += "</td>\n<td>";
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 + "</td>\n<td><span class=\"model-signature\"></span></td>";
},"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;
@@ -978,61 +1043,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 " <textarea class='body-textarea' readonly='readonly' name='"
+ 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)))
+ "'>"
+ 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)))
+ "</textarea>\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 " <option selected=\"\" value=''></option>\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 " <option selected=\"\" value='"
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
+ "'>"
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
+ " (default)</option>\n";
},"12":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <option value='"
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
+ "'>"
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
+ "</option>\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 = "<td class='code'>"
+ 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)))
+ "</td>\n<td>\n <select ";
stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
+ "</td>\n<td>\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
if (stack1 != null) { buffer += stack1; }
buffer += " class='parameter' name='"
+ 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";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(5, data),"data":data});
if (stack1 != null) { buffer += stack1; }
stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
if (stack1 != null) { buffer += stack1; }
buffer += " </select>\n</td>\n<td class=\"markdown\">";
buffer += "</td>\n<td class=\"markdown\">";
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 += "</td>\n<td>";
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 + "</td>\n<td><span class=\"model-signature\"></span></td>";
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\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; },
@@ -1100,7 +1142,7 @@ OperationView = (function(_super) {
OperationView.prototype.render = function() {
var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, modelAuths, o, param, ref, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4;
isMethodSubmissionSupported = true;
isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
if (!isMethodSubmissionSupported) {
this.model.isReadOnly = true;
}
@@ -1645,9 +1687,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 " <textarea class='body-textarea' readonly='readonly' name='"
return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
+ 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)))
+ "'>"
+ 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)))
@@ -1665,7 +1707,7 @@ this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":fun
},"6":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 = "<td class='code'>"
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
+ 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)))
+ "</td>\n<td>\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
@@ -1707,35 +1749,70 @@ ParameterContentTypeView = (function(_super) {
})(Backbone.View);
this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
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});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"2":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='"
return " <input type=\"file\" name='"
+ 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";
},"4":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"5":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <textarea class='body-textarea required' placeholder='(required)' name='"
+ 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)))
+ "'>"
+ 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)))
+ "</textarea>\n";
},"3":function(depth0,helpers,partials,data) {
+ "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
},"7":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <textarea class='body-textarea required' placeholder='(required)' name='"
+ 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)))
+ "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
},"9":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
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});
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"4":function(depth0,helpers,partials,data) {
},"10":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " "
return " <input class='parameter' class='required' type='file' name='"
+ 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";
},"12":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(13, data),"inverse":this.program(15, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"13":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <input class='parameter required' minlength='1' name='"
+ 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)))
+ "' placeholder='(required)' type='text' value='"
+ 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) {
return " (empty)\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ "'/>\n";
},"15":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <input class='parameter required' minlength='1' name='"
+ 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)))
+ "' placeholder='(required)' type='text' value=''/>\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 = "<td class='code required'>"
+ 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)))
+ "</td>\n<td>\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
if (stack1 != null) { buffer += stack1; }
buffer += "</td>\n<td class=\"markdown\">";
buffer += "</td>\n<td>\n <strong><span class=\"markdown\">";
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 += "</td>\n<td>";
buffer += "</span></strong>\n</td>\n<td>";
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 + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
@@ -1849,73 +1926,26 @@ ParameterView = (function(_super) {
})(Backbone.View);
this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
this["Handlebars"]["templates"]["parameter_content_type"] = 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});
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : 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 helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <input type=\"file\" name='"
+ 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";
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) {
var stack1, buffer = "";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":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=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"5":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <textarea class='body-textarea required' placeholder='(required)' name='"
+ 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)))
+ "'>"
+ 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)))
+ "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
},"7":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <textarea class='body-textarea required' placeholder='(required)' name='"
+ 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)))
+ "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
},"9":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : 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 " <input class='parameter' class='required' type='file' name='"
+ 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";
},"12":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(13, data),"inverse":this.program(15, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"13":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <input class='parameter required' minlength='1' name='"
+ 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)))
+ "' placeholder='(required)' type='text' value='"
+ 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";
},"15":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <input class='parameter required' minlength='1' name='"
+ 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)))
+ "' placeholder='(required)' type='text' value=''/>\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 = "<td class='code required'>"
+ 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)))
+ "</td>\n<td>\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
if (stack1 != null) { buffer += stack1; }
buffer += "</td>\n<td>\n <strong><span class=\"markdown\">";
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 += "</span></strong>\n</td>\n<td>";
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 + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
return buffer + "</select>\n";
},"useData":true});
var ResourceView,
__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; },
@@ -1988,56 +2018,6 @@ ResourceView = (function(_super) {
})(Backbone.View);
this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : 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=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.consumes : 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 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) {
@@ -2076,6 +2056,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;
@@ -2148,26 +2178,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; },
@@ -2211,14 +2228,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.0-M1
* @version v2.1.1-M1
* @link http://swagger.io
* @license apache 2.0
*/
@@ -31,7 +31,13 @@ ArrayModel.prototype.createJSONSample = function(modelsToIgnore) {
}
else if (this.ref) {
var name = simpleRef(this.ref);
result = models[name].createJSONSample();
if(typeof modelsToIgnore[name] === 'undefined') {
modelsToIgnore[name] = this;
result = models[name].createJSONSample(modelsToIgnore);
}
else {
return name;
}
}
return [ result ];
};
@@ -90,6 +96,7 @@ SwaggerAuthorizations.prototype.apply = function (obj, authorizations) {
else {
// 2.0 support
if (Array.isArray(authorizations)) {
for (var i = 0; i < authorizations.length; i++) {
var auth = authorizations[i];
for (name in auth) {
@@ -607,12 +614,15 @@ var Operation = function(parent, scheme, operationId, httpMethod, path, args, de
param.allowableValues.descriptiveValues.push({value : value, isDefault: isDefault});
}
}
if(param.type === 'array' && typeof param.allowableValues === 'undefined') {
// can't show as a list if no values to select from
delete param.isList;
delete param.allowMultiple;
if(param.type === 'array') {
innerType = [innerType];
if(typeof param.allowableValues === 'undefined') {
// can't show as a list if no values to select from
delete param.isList;
delete param.allowMultiple;
}
}
param.signature = this.getModelSignature(innerType, models);
param.signature = this.getModelSignature(innerType, models).toString();
param.sampleJSON = this.getModelSampleJSON(innerType, models);
param.responseClassSignature = param.signature;
}
@@ -764,16 +774,21 @@ Operation.prototype.getModelSignature = function(type, definitions) {
listType = true;
type = type[0];
}
else if(typeof type === 'undefined')
type = 'undefined';
if(type === 'string')
isPrimitive = true;
else
isPrimitive = (listType && definitions[listType]) || (definitions[type]) ? false : true;
if (isPrimitive) {
return type;
if(listType)
return 'Array[' + type + ']';
else
return type.toString();
} else {
if (listType)
return definitions[type].getMockSignature();
return 'Array[' + definitions[type].getMockSignature() + ']';
else
return definitions[type].getMockSignature();
}
@@ -965,8 +980,13 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
fail(message);
return;
}
var headers = this.getHeaderParams(args);
headers = this.setContentTypes(args, opts);
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 body = this.getBody(headers, args);
var url = this.urlify(args);
@@ -1013,10 +1033,10 @@ Operation.prototype.setContentTypes = function(args, opts) {
else
definedFormParams.push(param);
}
else if(param.in === 'header' && this.headers) {
else if(param.in === 'header' && opts) {
var key = param.name;
var headerValue = this.headers[param.name];
if(typeof this.headers[param.name] !== 'undefined')
var headerValue = opts[param.name];
if(typeof opts[param.name] !== 'undefined')
headers[key] = headerValue;
}
else if(param.in === 'body' && typeof args[param.name] !== 'undefined') {
@@ -1184,21 +1204,20 @@ var Model = function(name, definition) {
};
Model.prototype.createJSONSample = function(modelsToIgnore) {
var result = {};
var i, result = {};
modelsToIgnore = (modelsToIgnore||{});
modelsToIgnore[this.name] = this;
var i;
for (i = 0; i < this.properties.length; i++) {
prop = this.properties[i];
result[prop.name] = prop.getSampleValue(modelsToIgnore);
var sample = prop.getSampleValue(modelsToIgnore);
result[prop.name] = sample;
}
delete modelsToIgnore[this.name];
return result;
};
Model.prototype.getSampleValue = function(modelsToIgnore) {
var i;
var obj = {};
var i, obj = {};
for(i = 0; i < this.properties.length; i++ ) {
var property = this.properties[i];
obj[property.name] = property.sampleValue(false, modelsToIgnore);
@@ -1207,8 +1226,7 @@ Model.prototype.getSampleValue = function(modelsToIgnore) {
};
Model.prototype.getMockSignature = function(modelsToIgnore) {
var propertiesStr = [];
var i, prop;
var i, prop, propertiesStr = [];
for (i = 0; i < this.properties.length; i++) {
prop = this.properties[i];
propertiesStr.push(prop.toString());
@@ -1282,7 +1300,7 @@ Property.prototype.isArray = function () {
Property.prototype.sampleValue = function(isArray, ignoredModels) {
isArray = (isArray || this.isArray());
ignoredModels = (ignoredModels || {});
var type = getStringSignature(this.obj);
var type = getStringSignature(this.obj, true);
var output;
if(this.$ref) {
@@ -1292,8 +1310,9 @@ Property.prototype.sampleValue = function(isArray, ignoredModels) {
ignoredModels[type] = this;
output = refModel.getSampleValue(ignoredModels);
}
else
type = refModel;
else {
output = refModelName;
}
}
else if(this.example)
output = this.example;
@@ -1324,16 +1343,20 @@ Property.prototype.sampleValue = function(isArray, ignoredModels) {
return output;
};
getStringSignature = function(obj) {
getStringSignature = function(obj, baseComponent) {
var str = '';
if(typeof obj.$ref !== 'undefined')
str += simpleRef(obj.$ref);
else if(typeof obj.type === 'undefined')
str += 'object';
else if(obj.type === 'array') {
str += 'Array[';
str += getStringSignature((obj.items || obj.$ref || {}));
str += ']';
if(baseComponent)
str += getStringSignature((obj.items || obj.$ref || {}));
else {
str += 'Array[';
str += getStringSignature((obj.items || obj.$ref || {}));
str += ']';
}
}
else if(obj.type === 'integer' && obj.format === 'int32')
str += 'integer';

View File

@@ -16,6 +16,9 @@ class SwaggerUi extends Backbone.Router
@dom_id = options.dom_id
delete options.dom_id
if not options.supportedSubmitMethods?
options.supportedSubmitMethods = ['get','put','post','delete','head','options','patch']
# Create an empty div which contains the dom_id
$('body').append('<div id="' + @dom_id + '"></div>') if not $('#' + @dom_id)?

View File

@@ -44,7 +44,7 @@ class OperationView extends Backbone.View
$(e.currentTarget.parentNode).find('#api_information_panel').hide()
render: ->
isMethodSubmissionSupported = true #jQuery.inArray(@model.method, @model.supportedSubmitMethods) >= 0
isMethodSubmissionSupported = jQuery.inArray(@model.method, @model.supportedSubmitMethods()) >= 0
@model.isReadOnly = true unless isMethodSubmissionSupported
# 1.2 syntax for description was `notes`