|
|
@@ -334,6 +334,17 @@ |
|
|
|
return returnVal; |
|
|
|
}; |
|
|
|
|
|
|
|
SwaggerModel.prototype.createJSONSample = function(modelToIgnore) { |
|
|
|
var prop, result, _i, _len, _ref; |
|
|
|
result = {}; |
|
|
|
_ref = this.properties; |
|
|
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
|
|
|
prop = _ref[_i]; |
|
|
|
result[prop.name] = prop.getSampleValue(modelToIgnore); |
|
|
|
} |
|
|
|
return result; |
|
|
|
}; |
|
|
|
|
|
|
|
return SwaggerModel; |
|
|
|
|
|
|
|
})(); |
|
|
@@ -363,6 +374,24 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
SwaggerModelProperty.prototype.getSampleValue = function(modelToIgnore) { |
|
|
|
var result; |
|
|
|
if ((this.refModel != null) && (!(this.refModel === modelToIgnore))) { |
|
|
|
result = this.refModel.createJSONSample(this.refModel); |
|
|
|
} else { |
|
|
|
if (this.isArray) { |
|
|
|
result = this.refDataType; |
|
|
|
} else { |
|
|
|
result = this.dataType; |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.isArray) { |
|
|
|
return [result]; |
|
|
|
} else { |
|
|
|
return result; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
SwaggerModelProperty.prototype.toString = function() { |
|
|
|
var str; |
|
|
|
str = this.name + ': ' + this.dataTypeWithRef; |
|
|
@@ -424,6 +453,7 @@ |
|
|
|
parameter.allowableValues.values = this.resource.api.booleanValues; |
|
|
|
} |
|
|
|
parameter.signature = this.getSignature(parameter.dataType, this.resource.models); |
|
|
|
parameter.sampleJSON = this.getSampleJSON(parameter.dataType, this.resource.models); |
|
|
|
if (parameter.allowableValues != null) { |
|
|
|
if (parameter.allowableValues.valueType === "RANGE") { |
|
|
|
parameter.isRange = true; |
|
|
@@ -478,6 +508,17 @@ |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
SwaggerOperation.prototype.getSampleJSON = function(dataType, models) { |
|
|
|
var isPrimitive, listType, val; |
|
|
|
listType = this.isListType(dataType); |
|
|
|
isPrimitive = ((listType != null) && models[listType]) || (models[dataType] != null) ? false : true; |
|
|
|
val = isPrimitive ? void 0 : (listType != null ? models[listType].createJSONSample() : models[dataType].createJSONSample()); |
|
|
|
if (val) { |
|
|
|
val = listType ? [val] : val; |
|
|
|
return JSON.stringify(val, null, 2); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
SwaggerOperation.prototype["do"] = function(args, callback, error) { |
|
|
|
var body, headers; |
|
|
|
if (args == null) { |
|
|
|