From a126c178415a1fb307c1cf7b8e9cb4073a4c4906 Mon Sep 17 00:00:00 2001 From: Josh Ponelat Date: Thu, 4 Jun 2015 08:45:37 +0200 Subject: [PATCH] fixed support for default values in param_list --- src/main/javascript/view/ParameterView.js | 10 +++++++-- src/main/template/param_list.handlebars | 26 +++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/javascript/view/ParameterView.js b/src/main/javascript/view/ParameterView.js index b5079c48e2f..ff8a296ad57 100644 --- a/src/main/javascript/view/ParameterView.js +++ b/src/main/javascript/view/ParameterView.js @@ -30,7 +30,13 @@ SwaggerUi.Views.ParameterView = Backbone.View.extend({ this.model.paramType = this.model.in || this.model.paramType; this.model.isBody = this.model.paramType === 'body' || this.model.in === 'body'; this.model.isFile = type && type.toLowerCase() === 'file'; - this.model.default = (this.model.default || this.model.defaultValue); + + // Allow for default === false + if(typeof this.model.default === 'undefined') { + this.model.default = this.model.defaultValue; + } + + this.model.hasDefault = (typeof this.model.default !== 'undefined'); this.model.valueId = 'm' + this.model.name + Math.random(); if (this.model.allowableValues) { @@ -99,4 +105,4 @@ SwaggerUi.Views.ParameterView = Backbone.View.extend({ } } } -}); \ No newline at end of file +}); diff --git a/src/main/template/param_list.handlebars b/src/main/template/param_list.handlebars index 69a70b4bd68..c3913c35608 100644 --- a/src/main/template/param_list.handlebars +++ b/src/main/template/param_list.handlebars @@ -1,23 +1,17 @@