swagger-client
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -355,9 +355,11 @@ // Generated by CoffeeScript 1.4.0 | ||
SwaggerModel.prototype.createJSONSample = function(modelToIgnore) { | ||
SwaggerModel.prototype.createJSONSample = function(modelsToIgnore) { | ||
var prop, result, _i, _len, _ref; | ||
result = {}; | ||
modelsToIgnore = modelsToIgnore || []; | ||
modelsToIgnore.push(this.name); | ||
_ref = this.properties; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
prop = _ref[_i]; | ||
result[prop.name] = prop.getSampleValue(modelToIgnore); | ||
result[prop.name] = prop.getSampleValue(modelsToIgnore); | ||
} | ||
@@ -376,3 +378,3 @@ return result; | ||
this.dataType = obj.type; | ||
this.isArray = this.dataType.toLowerCase() === 'array'; | ||
this.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set'); | ||
this.descr = obj.description; | ||
@@ -398,8 +400,8 @@ this.required = obj.required; | ||
SwaggerModelProperty.prototype.getSampleValue = function(modelToIgnore) { | ||
SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) { | ||
var result; | ||
if ((this.refModel != null) && (!(this.refModel === modelToIgnore))) { | ||
result = this.refModel.createJSONSample(this.refModel); | ||
if ((this.refModel != null) && (modelsToIgnore.indexOf(this.refModel.name) === -1)) { | ||
result = this.refModel.createJSONSample(modelsToIgnore); | ||
} else { | ||
if (this.isArray) { | ||
if (this.isCollection) { | ||
result = this.refDataType; | ||
@@ -410,3 +412,3 @@ } else { | ||
} | ||
if (this.isArray) { | ||
if (this.isCollection) { | ||
return [result]; | ||
@@ -772,2 +774,4 @@ } else { | ||
window.SwaggerModelProperty = SwaggerModelProperty; | ||
}).call(this); |
@@ -11,3 +11,3 @@ { | ||
"description": "swagger.js is a javascript client for use with swaggering APIs.", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"homepage": "http://swagger.wordnik.com", | ||
@@ -14,0 +14,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
160128
3556