--- v6/model.js 2016-03-31 18:14:00.000000000 +0100 +++ enbd/model.js 2016-06-11 08:15:18.000000000 +0100 @@ -2307,6 +2307,7 @@ this.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set'); this.descr = obj.description; this.required = obj.required; + this.default = obj.default; if (obj.items != null) { if (obj.items.type != null) { this.refDataType = obj.items.type; @@ -2342,7 +2343,7 @@ if (this.isCollection) { result = this.toSampleValue(this.refDataType, modelsToIgnore); } else { - result = this.toSampleValue(this.dataType, modelsToIgnore); + result = this.toSampleValue(this.dataType, modelsToIgnore, this.default); } } if (this.isCollection) { @@ -2351,16 +2352,16 @@ return result; } }; - this.toSampleValue = function(value, modelsToIgnore) { + this.toSampleValue = function(value, modelsToIgnore, defaultValue) { var result; if (value === "integer") { - result = 0; + result = defaultValue||0; } else if (value === "boolean") { - result = false; + result = defaultValue||false; } else if (value === "double" || value === "number") { - result = 0.0; + result = defaultValue||0.0; } else if (value === "string") { - result = ""; + result = defaultValue||""; } else if (Apigee.APIModel.originalExpandedSchema[value]) { var swaggerModel = new Apigee.APIModel.SwaggerModel( value, Apigee.APIModel.originalExpandedSchema[value]); result = swaggerModel.createJSONSample(modelsToIgnore);