From ae2029faf986325050b04b4c394dfbae36f52172 Mon Sep 17 00:00:00 2001 From: Marco Ellwanger Date: Wed, 18 Feb 2015 16:17:20 -0800 Subject: [PATCH] Don't discard false as a json schema example value for a boolean property --- lib/swagger-client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/swagger-client.js b/lib/swagger-client.js index 6ff00aea606..326e6b472fd 100644 --- a/lib/swagger-client.js +++ b/lib/swagger-client.js @@ -1288,7 +1288,7 @@ var Property = function(name, obj, required) { this.optional = true; this.optional = !required; this.default = obj.default || null; - this.example = obj.example || null; + this.example = obj.example !== undefined ? obj.example : null; this.collectionFormat = obj.collectionFormat || null; this.maximum = obj.maximum || null; this.exclusiveMaximum = obj.exclusiveMaximum || null; @@ -1333,7 +1333,7 @@ Property.prototype.sampleValue = function(isArray, ignoredModels) { output = refModelName; } } - else if(this.example) + else if(this.example !== undefined) output = this.example; else if(this.default) output = this.default;