\n\n
\n
\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; }
buffer += "\n
\n\n
\n";
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.sampleJSON : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.sampleJSON : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
if (stack1 != null) { buffer += stack1; }
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.sampleXML : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.noop,"data":data});
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.sampleXML : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer + "
\n
\n";
-},"useData":true});
+},"2":function(depth0,helpers,partials,data) {
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "
\n
"
+ + 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)))
+ + "
\n ";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isParam : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "\n
\n";
+},"3":function(depth0,helpers,partials,data) {
+ return "
";
+ },"5":function(depth0,helpers,partials,data) {
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "
\n
"
+ + escapeExpression(((helper = (helper = helpers.sampleXML || (depth0 != null ? depth0.sampleXML : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleXML","hash":{},"data":data}) : helper)))
+ + "
\n ";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isParam : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "\n
\n";
+},"7":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " "
+ + escapeExpression(((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper)))
+ + "\n";
+},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, helperMissing=helpers.helperMissing;
+ stack1 = ((helpers.if_or || (depth0 && depth0.if_or) || helperMissing).call(depth0, (depth0 != null ? depth0.sampleJSON : depth0), (depth0 != null ? depth0.sampleXML : depth0), {"name":"if_or","hash":{},"fn":this.program(1, data),"inverse":this.program(7, data),"data":data}));
+ if (stack1 != null) { return stack1; }
+ else { return ''; }
+ },"useData":true});
this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var lambda=this.lambda, escapeExpression=this.escapeExpression;
return "
\n | "
@@ -25107,7 +25124,7 @@ SwaggerUi.Views.HeaderView = Backbone.View.extend({
showPetStore: function(){
this.trigger('update-swagger-ui', {
- url:'http://petstore.swagger.io/v2/swagger.json'
+ url:'http://localhost:3001/order2.json'
});
},
@@ -25480,6 +25497,10 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
sampleXML: isXML ? SwaggerUi.partials.signature.createXMLSample(value.definition, value.models) : false,
signature: SwaggerUi.partials.signature.getModelSignature(value.name, value.definition, value.models, value.modelPropertyMacro)
};
+ } else {
+ signatureModel = {
+ signature: SwaggerUi.partials.signature.getPrimitiveSignature(value)
+ };
}
}
} else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
@@ -26163,6 +26184,7 @@ SwaggerUi.Views.ParameterView = Backbone.View.extend({
var modelDefinitions = this.model.modelSignature.definitions;
var schema = this.model.schema || {};
var consumes = this.model.consumes || [];
+ var sampleJSON, signatureView;
if (typeof type === 'undefined') {
@@ -26195,20 +26217,21 @@ SwaggerUi.Views.ParameterView = Backbone.View.extend({
var isXML = this.contains(consumes, 'xml');
var isJSON = isXML ? this.contains(consumes, 'json') : true;
+ sampleJSON = SwaggerUi.partials.signature.createParameterJSONSample(modelType, modelDefinitions);
var template = this.template();
$(this.el).html(template(this.model));
var signatureModel = {
- sampleJSON: isJSON ? SwaggerUi.partials.signature.createParameterJSONSample(modelType, modelDefinitions) : false,
- sampleXML: isXML ? SwaggerUi.partials.signature.createXMLSample(schema, modelDefinitions, true) : false,
+ sampleJSON: isJSON ? sampleJSON : false,
+ sampleXML: sampleJSON && isXML ? SwaggerUi.partials.signature.createXMLSample(schema, modelDefinitions, true) : false,
isParam: true,
signature: SwaggerUi.partials.signature.getParameterModelSignature(modelType, modelDefinitions),
defaultRendering: this.model.defaultRendering
};
- if (this.model.sampleJSON) {
- var signatureView = new SwaggerUi.Views.SignatureView({model: signatureModel, tagName: 'div'});
+ if (sampleJSON) {
+ signatureView = new SwaggerUi.Views.SignatureView({model: signatureModel, tagName: 'div'});
$('.model-signature', $(this.el)).append(signatureView.render().el);
}
else {
@@ -27065,6 +27088,20 @@ SwaggerUi.partials.signature = (function () {
return value;
};
+ var getPrimitiveSignature = function (schema) {
+ var type, items;
+
+ schema = schema || {};
+ items = schema.items || {};
+ type = schema.type || '';
+
+ switch (type) {
+ case 'object': return 'Object is not a primitive';
+ case 'array' : return 'Array[' + items.type + ']';
+ default: return type;
+ }
+ };
+
var createPrimitiveXML = function (descriptor) {
var name = descriptor.name;
var definition = descriptor.definition;
@@ -27253,7 +27290,8 @@ SwaggerUi.partials.signature = (function () {
getParameterModelSignature: getParameterModelSignature,
createParameterJSONSample: createParameterJSONSample,
createSchemaXML: createSchemaXML,
- createXMLSample: createXMLSample
+ createXMLSample: createXMLSample,
+ getPrimitiveSignature: getPrimitiveSignature
};
})();
@@ -27429,23 +27467,26 @@ SwaggerUi.Views.StatusCodeView = Backbone.View.extend({
},
render: function(){
+ var responseModel, responseModelView;
var value = this.router.api.models[this.model.responseModel];
$(this.el).html(Handlebars.templates.status_code(this.model));
if (this.router.api.models.hasOwnProperty(this.model.responseModel)) {
- var responseModel = {
+ responseModel = {
sampleJSON: JSON.stringify(SwaggerUi.partials.signature.createJSONSample(value), void 0, 2),
- sampleXML: this.model.isXML ? SwaggerUi.partials.signature.createXMLSample(this.model.schema, value.models) : false,
+ sampleXML: this.model.isXML ? SwaggerUi.partials.signature.createXMLSample(this.model.schema, this.router.api.models) : false,
isParam: false,
signature: SwaggerUi.partials.signature.getModelSignature(this.model.responseModel, value, this.router.api.models),
defaultRendering: this.model.defaultRendering
};
-
- var responseModelView = new SwaggerUi.Views.SignatureView({model: responseModel, tagName: 'div'});
- $('.model-signature', this.$el).append(responseModelView.render().el);
} else {
- $('.model-signature', this.$el).html('');
+ responseModel = {
+ signature: SwaggerUi.partials.signature.getPrimitiveSignature(this.model.schema)
+ };
}
+
+ responseModelView = new SwaggerUi.Views.SignatureView({model: responseModel, tagName: 'div'});
+ $('.model-signature', this.$el).append(responseModelView.render().el);
return this;
}
});}).call(this);
\ No newline at end of file
diff --git a/dist/swagger-ui.min.js b/dist/swagger-ui.min.js
index 07e46766..cb677286 100644
--- a/dist/swagger-ui.min.js
+++ b/dist/swagger-ui.min.js
@@ -1,11 +1,11 @@
-(function(){function e(){e.history=e.history||[],e.history.push(arguments),this.console&&console.log(Array.prototype.slice.call(arguments)[0])}this.Handlebars=this.Handlebars||{},this.Handlebars.templates=this.Handlebars.templates||{},this.Handlebars.templates.apikey_button_view=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,r){var i,a="function",o=t.helperMissing,s=this.escapeExpression;return"\n\n"},useData:!0}),this.Handlebars.templates.basic_auth_button_view=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,r){return'\n\n\n'},useData:!0}),this.Handlebars.templates.content_type=Handlebars.template({1:function(e,t,n,r){var i,a="";return i=t.each.call(e,null!=e?e.produces:e,{name:"each",hash:{},fn:this.program(2,r),inverse:this.noop,data:r}),null!=i&&(a+=i),a},2:function(e,t,n,r){var i=this.lambda,a=this.escapeExpression;return' \n"},4:function(e,t,n,r){return' \n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,r){var i,a,o="function",s=t.helperMissing,u=this.escapeExpression,l='\n\n"},useData:!0}),$(function(){$.fn.vAlign=function(){return this.each(function(){var e=$(this).height(),t=$(this).parent().height(),n=(t-e)/2;$(this).css("margin-top",n)})},$.fn.stretchFormtasticInputWidthToParent=function(){return this.each(function(){var e=$(this).closest("form").innerWidth(),t=parseInt($(this).closest("form").css("padding-left"),10)+parseInt($(this).closest("form").css("padding-right"),10),n=parseInt($(this).css("padding-left"),10)+parseInt($(this).css("padding-right"),10);$(this).css("width",e-t-n)})},$("form.formtastic li.string input, form.formtastic textarea").stretchFormtasticInputWidthToParent(),$("ul.downplayed li div.content p").vAlign(),$("form.sandbox").submit(function(){var e=!0;return $(this).find("input.required").each(function(){$(this).removeClass("error"),""===$(this).val()&&($(this).addClass("error"),$(this).wiggle(),e=!1)}),e})}),Function.prototype.bind&&console&&"object"==typeof console.log&&["log","info","warn","error","assert","dir","clear","profile","profileEnd"].forEach(function(e){console[e]=this.bind(console[e],console)},Function.prototype.call),window.Docs={shebang:function(){var e=$.param.fragment().split("/");switch(e.shift(),e.length){case 1:if(e[0].length>0){var t="resource_"+e[0];Docs.expandEndpointListForResource(e[0]),$("#"+t).slideto({highlight:!1})}break;case 2:Docs.expandEndpointListForResource(e[0]),$("#"+t).slideto({highlight:!1});var n=e.join("_"),r=n+"_content";Docs.expandOperation($("#"+r)),$("#"+n).slideto({highlight:!1})}},toggleEndpointListForResource:function(e){var t=$("li#resource_"+Docs.escapeResourceName(e)+" ul.endpoints");t.is(":visible")?($.bbq.pushState("#/",2),Docs.collapseEndpointListForResource(e)):($.bbq.pushState("#/"+e,2),Docs.expandEndpointListForResource(e))},expandEndpointListForResource:function(e){var e=Docs.escapeResourceName(e);if(""==e)return void $(".resource ul.endpoints").slideDown();$("li#resource_"+e).addClass("active");var t=$("li#resource_"+e+" ul.endpoints");t.slideDown()},collapseEndpointListForResource:function(e){var e=Docs.escapeResourceName(e);if(""==e)return void $(".resource ul.endpoints").slideUp();$("li#resource_"+e).removeClass("active");var t=$("li#resource_"+e+" ul.endpoints");t.slideUp()},expandOperationsForResource:function(e){return Docs.expandEndpointListForResource(e),""==e?void $(".resource ul.endpoints li.operation div.content").slideDown():void $("li#resource_"+Docs.escapeResourceName(e)+" li.operation div.content").each(function(){Docs.expandOperation($(this))})},collapseOperationsForResource:function(e){return Docs.expandEndpointListForResource(e),""==e?void $(".resource ul.endpoints li.operation div.content").slideUp():void $("li#resource_"+Docs.escapeResourceName(e)+" li.operation div.content").each(function(){Docs.collapseOperation($(this))})},escapeResourceName:function(e){return e.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},expandOperation:function(e){e.slideDown()},collapseOperation:function(e){e.slideUp()}},Handlebars.registerHelper("sanitize",function(e){return e=e.replace(/ |